I have an Amazon Elastic Compute Cloud (Amazon EC2) instance that is runs Amazon Linux, Red Hat Enterprise Linux (RHEL), CentOS, or Ubuntu. I want to 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. Turning on 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. Reconfigure the interval from the default value to 1 minute intervals to collect more granular data.
Resolution
Amazon Linux 2
-
To install the EPEL release package for RHEL 7, use the amazon-linux-extras command:
sudo amazon-linux-extras install epel
-
Install the monitoring tools:
sudo yum -y install sysstat atop --enablerepo=epel
-
Change the log collection interval:
sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/sysconfig/atopsudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat
-
Turn on and restart services:
sudo systemctl enable atop.service crond.service sysstat.servicesudo systemctl restart atop.service crond.service sysstat.service
Amazon Linux AMI
-
Install the monitoring tools.
Note: Amazon Linux has the EPEL repository already installed.
sudo yum -y install sysstat atop --enablerepo=epelsudo 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
-
Turn on 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
-
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
-
Install the monitoring tools:
sudo dnf -y install sysstat atop --enablerepo=epel
-
Change the log collection interval:
sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/sysconfig/atopsudo 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
-
Turn on and restart services:
sudo systemctl enable atop.service crond.service sysstat.servicesudo systemctl restart atop.service crond.service sysstat.service
RHEL 7 and CentOS 7
-
Install the EPEL release package for RHEL 7:
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-
Install the monitoring tools:
sudo yum -y install sysstat atop --enablerepo=epel
-
Change the log collection interval:
sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/sysconfig/atopsudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat
-
Turn on and restart services:
sudo systemctl enable atop.service crond.service sysstat.servicesudo systemctl restart atop.service crond.service sysstat.service
RHEL 6 and CentOS 6
-
Install the EPEL release package for RHEL 6:
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
-
Install the monitoring tools:
sudo yum -y install sysstat atop --enablerepo=epel
-
Change the log collection interval:
sudo sed -i 's/^INTERVAL=600.*/INTERVAL=60/' /etc/sysconfig/atopsudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/cron.d/sysstat
-
Turn on and restart services:
for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; done
Ubuntu
Ubuntu 20.04
-
Install the monitoring tools:
sudo apt-get updatesudo apt-get -y install atop sysstat
-
To change the log collection interval and configure sysstat to report disk and inodes usage, add -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/sysstatsudo bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"
-
Turn on and restart services:
sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstatsudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service
Ubuntu 18.04:
-
Install the monitoring tools:
sudo apt-get updatesudo apt-get -y install atop sysstat
-
To change the log collection interval and configure sysstat to report disk and inodes usage, add -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/sysstatsudo bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"
-
Turn on and restart services:
sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstatsudo systemctl enable atop.service cron.service sysstat.servicesudo systemctl restart atop.service cron.service sysstat.service
Ubuntu 16.04
-
Install the monitoring tools:
sudo apt-get updatesudo apt-get -y install atop sysstat
-
To change the log collection interval and configure sysstat to report disk and inodes usage, add -S XALL in the configuration file:
sudo sed -i 's/^INTERVAL=600.*/INTERVAL=60/' /etc/default/atopsudo 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/sysstatsudo bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"
-
Turn on and restart services:
sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstatsudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service
SLES and SLES for SAP
SLES12
-
Turn on PackageHub:
(source /etc/os-release; sudo SUSEConnect -p PackageHub/$VERSION_ID/x86_64)
-
Install SAR and ATOP:
zypper in sysstatzypper addrepo https://download.opensuse.org/repositories/server:monitoring/SLE_12_SP5/server:monitoring.repozypper ref -szypper in atop atop-daemon
-
Turn on the services:
systemctl enable sysstatsystemctl enable --now atop
SLES15
-
Turn on PackageHub:
(source /etc/os-release; sudo SUSEConnect -p PackageHub/$VERSION_ID/x86_64)
-
Install SAR and ATOP:
zypper in sysstat(source /etc/os-release;
sudo SUSEConnect -p PackageHub/$VERSION_ID/x86_64)
sudo zypper ref -ssudo zypper in atop atop-daemon
-
Turn on the services:
systemctl enable sysstatsystemctl enable --now atop
Related information
Add repositories on an AL2 instance
What is Amazon Linux 2?
Amazon Linux 2 FAQs
EPEL website