How do I configure the ATOP and SAR monitoring tools for my EC2 instance running Amazon Linux, RHEL, CentOS, or Ubuntu?

Last updated: 2020-11-18

I have an Amazon Elastic Compute Cloud (Amazon EC2) instance that is running Amazon Linux, Red Hat Enterprise Linux (RHEL), CentOS, or Ubuntu. How do I configure the ATOP and SAR monitoring tools to collect granular data about process utilization?

Short description

ATOP and SAR monitoring tools aren't configured on standard Amazon Machine Images (AMIs). You can install these monitoring tools on Amazon Linux, RHEL, CentOS, or Ubuntu Linux-based distributions. Enabling ATOP and SAR monitoring provides a more granular view into the instance's process utilization with a 30-day retention history.

By default, ATOP and SAR monitoring tools collect metrics in 10-minutes intervals. You can reconfigure the interval from the default value to 1 minute intervals to collect more granular data.

Resolution

Amazon Linux 2

1.    Install the EPEL release package for RHEL 7 using the amazon-linux-extras command:

sudo amazon-linux-extras install epel

2.    Install the monitoring tools:

sudo yum -y install sysstat atop --enablerepo=epel

3.    Change the log collection interval:

sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/sysconfig/atop
sudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat

4.    Enable and restart services:

sudo systemctl enable atop.service crond.service sysstat.service
sudo systemctl restart atop.service crond.service sysstat.service

Amazon Linux AMI

1.    Install the monitoring tools.

Note: Amazon Linux already has the EPEL repository installed.

sudo yum -y install sysstat atop --enablerepo=epel
sudo sed -i 's/^INTERVAL=600.*/INTERVAL=60/' /etc/sysconfig/atop
sudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat

2.    Enable and restart services:

for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; done

RHEL and CentOS

The following configuration steps are the same for each major release of RHEL and CentOS.

RHEL 8 and CentOS 8:

1.    Install the EPEL release package for RHEL 8:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

2.    Install the monitoring tools:

sudo dnf -y install sysstat atop --enablerepo=epel

3.    Change the log collection interval:

sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/sysconfig/atop
sudo mkdir -v /etc/systemd/system/sysstat-collect.timer.d/
sudo bash -c "sed -e 's|every 10 minutes|every 1 minute|g' -e '/^OnCalendar=/ s|/10$|/1|' /usr/lib/systemd/system/sysstat-collect.timer > /etc/systemd/system/sysstat-collect.timer.d/override.conf"
sudo sed -i 's|^SADC_OPTIONS=.*|SADC_OPTIONS=" -S XALL"|' /etc/sysconfig/sysstat

4.    Enable and restart services:

sudo systemctl enable atop.service crond.service sysstat.service
sudo systemctl restart atop.service crond.service sysstat.service

RHEL 7 and CentOS 7:

1.    Install the EPEL release package for RHEL 7:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

2.    Install the monitoring tools:

sudo yum -y install sysstat atop --enablerepo=epel

3.    Change the log collection interval:

sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/sysconfig/atop
sudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat

4.    Enable and restart services:

sudo systemctl enable atop.service crond.service sysstat.service
sudo systemctl restart atop.service crond.service sysstat.service

RHEL 6 and CentOS 6:

1.    Install the EPEL release package for RHEL 6:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

2.    Install the monitoring tools:

sudo yum -y install sysstat atop --enablerepo=epel

3.    Change the log collection interval:

sudo sed -i 's/^INTERVAL=600.*/INTERVAL=60/' /etc/sysconfig/atop
sudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat

4.    Enable and restart services:

for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; done

Ubuntu

Ubuntu 20.04:

1.    Install the monitoring tools:

sudo apt-get update
sudo apt-get -y install atop sysstat

2.    Change the log collection interval and configure sysstat to report disk and inodes usage by adding -S XALL in the configuration file:

sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /usr/share/atop/atop.daily
sudo sed -i -e 's|5-55/10|*/1|' -e 's|every 10 minutes|every 1 minute|' -e 's|debian-sa1|debian-sa1 -S XALL|g' /etc/cron.d/sysstat
sudo bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"

3.    Enable and restart services:

sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstat
sudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service

Ubuntu 18.04:

1.    Install the monitoring tools:

sudo apt-get update
sudo apt-get -y install atop sysstat

2.    Change the log collection interval and configure sysstat to report disk and inodes usage by adding -S XALL in the configuration file:

sudo sed -i 's/^INTERVAL=600.*/INTERVAL=60/' /usr/share/atop/atop.daily
sudo sed -i -e 's|5-55/10|*/1|' -e 's|every 10 minutes|every 1 minute|' -e 's|debian-sa1|debian-sa1 -S XALL|g' /etc/cron.d/sysstat
sudo bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"

3.    Enable and restart services:

sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstat
sudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service

Ubuntu 16.04:

1.    Install the monitoring tools:

sudo apt-get update
sudo apt-get -y install atop sysstat

2.    Change the log collection interval and configure sysstat to report disk and inodes usage by adding -S XALL in the configuration file:

sudo sed -i 's/^INTERVAL=600.*/INTERVAL=60/' /etc/default/atop
sudo sed -i -e 's|5-55/10|*/1|' -e 's|every 10 minutes|every 1 minute|' -e 's|debian-sa1|debian-sa1 -S XALL|g' /etc/cron.d/sysstat
sudo bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"

3.    Enable and restart services:

sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstat
sudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service

Did this article help?


Do you need billing or technical support?