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

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 descriptionATOP 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.

ResolutionAmazon Linux 21.    Install the EPEL release package for RHEL 7 using the amazon-linux-extras command:sudo amazon-linux-extras install epel2.    Install the monitoring tools:sudo yum -y install sysstat atop --enablerepo=epel3.    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/sysstat4.    Enable and restart services:sudo systemctl enable atop.service crond.service sysstat.servicesudo systemctl restart atop.service crond.service sysstat.serviceAmazon Linux AMI1.    Install the monitoring tools.Note: Amazon Linux already has the EPEL repository installed.sudo yum -y install sysstat atop --enablerepo=epelsudo 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/sysstat2.    Enable and restart services:for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; doneRHEL and CentOSThe 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 -y2.    Install the monitoring tools:sudo dnf -y install sysstat atop --enablerepo=epel3.    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/sysstat4.    Enable and restart services:sudo systemctl enable atop.service crond.service sysstat.servicesudo systemctl restart atop.service crond.service sysstat.serviceRHEL 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.rpm2.    Install the monitoring tools:sudo yum -y install sysstat atop --enablerepo=epel3.    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/sysstat4.    Enable and restart services:sudo systemctl enable atop.service crond.service sysstat.servicesudo systemctl restart atop.service crond.service sysstat.serviceRHEL 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.rpm2.    Install the monitoring tools:sudo yum -y install sysstat atop --enablerepo=epel3.    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/sysstat4.    Enable and restart services:for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; doneUbuntuUbuntu 20.04:1.    Install the monitoring tools:sudo apt-get updatesudo apt-get -y install atop sysstat2.    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.dailysudo 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"3.    Enable 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.serviceUbuntu 18.04:1.    Install the monitoring tools:sudo apt-get updatesudo apt-get -y install atop sysstat2.    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.dailysudo 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"3.    Enable 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.serviceUbuntu 16.04:1.    Install the monitoring tools:sudo apt-get updatesudo apt-get -y install atop sysstat2.    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/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"3.    Enable 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

Related informationAdding repositories on an Amazon Linux instanceExtras library (Amazon Linux 2)Amazon Linux 2 FAQsEPEL website