Using Atop for Further Analysis of System Load (Linux)
Please use the “Print” function at the bottom of the page to create a PDF.
For Cloud Servers, Dedicated Servers and Server Power Deals
In this article, you will learn how to use the atop program for a deeper analysis of your server's system load.
Atop is an ASCII performance monitoring program that allows you to view the usage of a Linux system. Once atop is started, it displays CPU and memory usage by default as well as information about swap file usage, disk/SSD usage, and network connection usage at 10-second intervals. You can also view CPU usage, memory usage, and disk I/O for each process and thread, among other things. It also allows you to save system and process-level statistics in a compressed binary format to a file for long-term analysis. By default, these log files are kept for 28 days.
Installing Atop
To install atop, follow the steps below:
CentOS 7, CentOS Stream 8 and 9
Install the EPEL repository. To install this, enter the following command:
[root@localhost ~]# yum install epel-release
The following message appears:
Install 1 Package
Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]:Type y and press Enter.
The following message is displayed:Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-11.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]:Type y and press Enter.
To install atop, enter the following command:
[root@localhost ~]# yum install atop
The following message is displayed:
Install 1 Package
Total download size: 182 k
Installed size: 390 k
Is this ok [y/N]:Type y and press Enter.
The following message is displayed:Importing GPG key 0x2F86D6A1:
Userid : "Fedora EPEL (8) <epel@fedoraproject.org>"
Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8Type y and press Enter.
Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04
To install atop in Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, enter the following command:
[root@localhost ~]# sudo apt-get install atop
Starting the service atop and configuring the interval
Use the following command to start the atop service to begin automatic logging of system resources.
[root@localhost ~]# service atop start
Open the configuration file of atop with the editor vi. To do this, enter the following command:
CentOS 7, CentOS Stream 8 and 9vi /etc/sysconfig/atop
Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04
sudo vi /etc/init.d/atop
or
sudo vi /etc/default/atop
Set the required interval. To do this, adjust the entry INTERVAL=.
To save the changes made, press the ESC key and then type :wq. Then press Enter.
Starting Atop
To start atop, enter the following command:
[root@localhost ~]# atop
Important Keys and Key Combinations
To sort the processes, use the following keys and key combinations:
Key/Key Combination | Function |
---|---|
a | Sorts the current list automatically in the order of the system resource that is most heavily used |
c | Sorts the current list in the order of CPU usage |
d | Sorts the current list in the order of SSD/hard disk accesses |
m | Sorts the current list by memory usage |
n | Sorts the current list by network bandwidth used |
To exit the program, use the q button.
Creating Log Files
Atop can store system and process level statistics in a compressed binary format in a file.
If this file already exists and is identified as a raw data file, atop appends new samples to the file. If the file does not exist, it will be created. By default, only processes that were active during the interval are stored in the file.
To save this data to a file in a compressed binary format, enter the following command:
[root@localhost ~]# atop -w PATH/FILE
Please Note
By default, only processes that were active during the interval are saved in the raw file.
To save all processes, enter the following command:
[root@localhost ~]# atop -a
To monitor system usage and write the active processes to a file in ASCII code during a 30-minute period with a 1-minute interval, enter the following command:
[root@localhost ~]# atop -M 60 30 > /PFAD/DATEExample:
[root@localhost ~]# atop -M 60 30 > /log/atop
To write system and process activity information in a compressed binary format to a file during a 1-hour period with a 10-minute interval, enter the following command:
[root@localhost ~]# atop -w /tmp/atop.raw 600 6
Opening Log Files
By default, atop writes snapshots of system and process statistics to a compressed log file (e.g., /var/log/atop/atop_20140813) after installation. To open this log file, enter the following command:
[root@localhost ~]# atop -r </PFAD/DATEI>
Example:
[root@localhost ~]# atop -r /var/log/atop/atop_20211021
Once you have a log file open, use t to navigate forward in 10-minute intervals. To go back, use T. To return to the beginning of the file, press the r key.
If no file name is specified, the file /var/log/atop/atop_YYYYMMDD opens for input. The YYYYMMDD part represents the current date. If a filename with the symbolic name y is specified, the log file that was created yesterday is opened. If a filename with the symbolic name yyyy is specified in the above command, the log file that was created 4 days ago is opened.
More information about atop can be found here: