Using Atop for Further Analysis of System Load (Linux)

For Linux Cloud, Virtual, and Dedicated Servers

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 and Starting Atop

To install atop, enter the following command:

[root@localhost ~]# yum install 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:

https://linux.die.net/man/1/atop