I have an Amazon Elastic Compute Cloud (Amazon EC2) instance that 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 usage.
Short description
ATOP and SAR monitoring tools aren't configured on standard Amazon Machine Images (AMIs). However, you can install the monitoring tools on distributions based on Amazon Linux, RHEL, CentOS, SUSE Linux Enterprise Server (SLES), or Ubuntu Linux.
By default, ATOP and SAR monitoring tools collect metrics in 10-minute intervals and retain history for 30 days. To collect more granular data, you can reconfigure the collection time to 1-minute intervals.
Resolution
Install ATOP and SAR monitoring based on the operating system (OS) that your distribution runs.
AL2023
Amazon Linux 2023 (AL2023) includes the sysstat package by default. If your system doesn't have the sysstat package, then complete the following steps:
-
To install the monitoring tools, run the following command:
sudo yum -y install sysstat atop
-
To change the log collection interval, run the following commands:
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
-
To activate and restart services, run the following commands:
sudo systemctl enable atop.service sysstat.service
sudo systemctl restart atop.service sysstat.service
AL2
To install the ATOP and SAR monitoring tools on Amazon Linux 2 (AL2), complete the following steps:
-
To install the Extra Packages for Linux (EPEL) release package for RHEL 7, run the following command:
sudo amazon-linux-extras install epel
-
To install the monitoring tools, run the following command:
sudo yum -y install sysstat atop --enablerepo=epel
-
To change the log collection interval, run the following commands:
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
-
To activate and restart services, run the following commands:
sudo systemctl enable atop.service crond.service sysstat.service
sudo systemctl restart atop.service crond.service sysstat.service
Amazon Linux AMI
To install the ATOP and SAR monitoring tools, complete the following steps:
- To install the monitoring tools and change the log collection interval, run the following commands:
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
Note: Amazon Linux has the EPEL repository installed by default.
- To activate and restart services, run the following commands:
for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; done
RHEL and CentOS
Note: The following configuration steps are the same for each major release of RHEL and CentOS.
To install the ATOP and SAR monitoring tools, complete the following steps:
-
To install the EPEL release package, run the following command based on your RHEL or CentOS version:
RHEL 8, RHEL 9, CentOS 8, and CentOS Stream 9:
source /etc/os-release
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${VERSION_ID%.*}.noarch.rpm -y
RHEL 7 and CentOS 7:
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RHEL 6 and CentOS 6:
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
-
To install the monitoring tools, run the following command:
sudo dnf -y install sysstat atop --enablerepo=epel
-
To change the log collection interval, run the following commands based on your RHEL or CentOS version:
RHEL 8, RHEL 9, CentOS 8, and CentOS Stream 9:
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
RHEL 7 and CentOS 7:
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
RHEL 6 and CentOS 6:
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
-
To activate and restart services, run the following commands based on your RHEL or CentOS version:
RHEL 8, RHEL 9, CentOS 8, and CentOS Stream 9:
sudo systemctl enable atop.service sysstat.service
sudo systemctl restart atop.service sysstat.service
RHEL 7 and CentOS 7:
sudo systemctl enable atop.service crond.service sysstat.service
sudo systemctl restart atop.service crond.service sysstat.service
RHEL 6 and CentOS 6:
for _service in atop crond sysstat; do sudo chkconfig ${_service} on; sudo service ${_service} start; done
Ubuntu
To install the ATOP and SAR monitoring tools, complete the following steps:
-
To install the monitoring tools, run the following command:
sudo apt-get update
sudo apt-get -y install atop sysstat
-
To change the log collection interval, run the following commands based on your Ubuntu version:
Ubuntu 24.04 and Ubuntu 22.04:
sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/default/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 bash -c "echo 'SA1_OPTIONS=\"-S XALL\"' >> /etc/default/sysstat"
sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstat
Ubuntu 20.04:
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"
sudo sed -i 's|ENABLED="false"|ENABLED="true"|' /etc/default/sysstat
Ubuntu 18.04 and Ubuntu 16.04:
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"
-
To activate and restart services, run the following commands based on your Ubuntu version:
Ubuntu 24.04 and Ubuntu 22.04:
sudo systemctl enable atop.service sysstat.service
sudo systemctl restart atop.service sysstat.service
Ubuntu 20.04:
sudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service
Ubuntu 18.04 and Ubuntu 16.04:
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
SLES and SLES for SAP
To install the ATOP and SAR monitoring tools, complete the following steps:
-
To activate PackageHub, run the following command based on your SLES version.
SLES15:
source /etc/os-release
sudo SUSEConnect -p PackageHub/$VERSION_ID/x86_64
sudo zypper ref -s
SLES12:
source /etc/os-release
sudo SUSEConnect -p PackageHub/$VERSION_ID/x86_64
sudo zypper addrepo https://download.opensuse.org/repositories/server:monitoring/SLE_12_SP5/server:monitoring.repo
sudo zypper ref -s
Note: For SLES12, you also add the OpenSUSE server monitoring repository.
-
To install SAR and ATOP, run the following command:
sudo zypper in sysstat atop atop-daemon
-
To change the log collection interval, run the following commands based on your SLES version:
SLES15:
sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /etc/default/atop
sudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/sysstat/sysstat.cron
sudo sed -i 's/^SADC_OPTIONS=.*/SADC_OPTIONS=" -S XALL"/' /etc/sysstat/sysstat
SLES12:
sudo sed -i 's/^LOGINTERVAL=600.*/LOGINTERVAL=60/' /usr/share/atop/atop.daily
sudo sed -i -e 's|*/10|*/1|' -e 's|every 10 minutes|every 1 minute|' /etc/sysstat/sysstat.cron
sudo sed -i 's/^SADC_OPTIONS=.*/SADC_OPTIONS=" -S XALL"/' /etc/sysstat/sysstat
-
To activate and restart services, run the following commands:
sudo systemctl enable atop.service cron.service sysstat.service
sudo systemctl restart atop.service cron.service sysstat.service
Related information
Add repositories on an AL2 instance
Amazon Linux 2 FAQs
Extra Packages for Enterprise Linux (EPEL) on the Fedora Project website