Monitoring with Sar (sysstat) and atop


With sar and atop you have the possibility to monitor the performance of your server via the command line. With these programs you can, for example, see how busy your server was at 02.00 midnight and what processes have been running at the time.

In this article we will discuss the following:

* Installation of sar and atop
* Configuration of sar and atop
* Using sar
* Using atop

With these tools you can get a good (and historical) overview of what your VPS was doing what and at what times. Based on those details you can, for example, troubleshoot performance related issues.

Installation of sar and atop
If you make use of a image provided by CloudVPS then it’s very likely these tools are already installed on your server.

If they aren’t installed then please follow the instructions below for your Linux distribution. You can perform these instructions with the ‘root’ user.

The installation commands can vary based on your distribution:


# For Ubuntu:
apt install sar atop

# For CentOS:
yum install sar atop



Turning on Sar registration
Once the installation is finished atop will work directly, for sar, however, some additional steps are required.



# For Ubuntu
sed –i ‘s/false/true/’ /etc/default/sysstat
systemctl daemon-reload && systemctl restart sysstat

# For CentOS
systemctl start sysstat && systemctl enable sysstat



How to use sar
Sar Is a process that will provide you statistics every 10 minutes about the workload of your server. Those details will be saved to your disk. With sar, you can see the workload going back months if you need to.

Sar is specifically useful to create an overview that’s easily adjustable to further zoom in on the timeframes that you specifically wish to look at. The specific timeframes can also be seen with atop.

For an overview concerning the workload of your server you can use:


sar –u


Example output:

Linux 4.4.0-98-generic (test) 11/27/2017 _x86_64_ (1 CPU)

12:00:01 AM CPU %user %nice %system %iowait %steal %idle

12:05:01 AM all 0.17 0.00 0.10 0.00 0.06 99.66

12:10:01 AM all 0.20 0.00 0.06 0.02 0.03 99.69

12:15:01 AM all 0.26 0.00 0.07 0.00 0.04 99.62


10:40:01 AM all 0.36 0.00 0.13 0.01 0.04 99.46

10:45:01 AM all 0.14 0.00 0.08 0.00 0.05 99.73

10:50:01 AM all 0.83 0.00 0.15 0.00 0.07 98.94

Average: all 0.26 0.00 0.09 0.01 0.05 99.59


For an overview of the load between two timeframes on the 15th of the month you would use:


sar –u –s 10:00:00 –e 12:00:00 -f /var/log/sysstat/sa15

Linux 4.4.0-98-generic (test) 11/22/2017 _x86_64_ (1 CPU)

10:00:01 AM CPU %user %nice %system %iowait %steal %idle

10:05:01 AM all 0.18 0.00 0.07 0.01 0.15 99.59

10:10:01 AM all 0.16 0.00 0.10 0.00 0.16 99.59

10:15:01 AM all 0.16 0.00 0.10 0.00 0.14 99.59


11:45:01 AM all 0.28 0.00 0.08 0.00 0.07 99.57

11:50:01 AM all 0.17 0.00 0.07 0.00 0.08 99.68

11:55:01 AM all 0.15 0.00 0.06 0.00 0.09 99.70

Average: all 0.43 0.06 0.14 0.01 0.11 99.25


Sar mini cheat sheet
To see specific statistics quickly you can use the following commands:


Load sar –u

Per CPU sar -P ALL

Memory sar -r

I/O sar –b


What is atop

Whenever you start “atop” you will observe the load on your server every 10 seconds in an interactive screen. If there’s any processes that “atop” considers “causing high load” then those processes will be presented in an obvious colour scheme:







The tool “atop” writes, just like “sar” data to disk (every 10 minutes) about the workload on your server. This makes it possible to monitor what might have happened on your server during a certain timeframe.


If you want to use atop to go back to a certain timeframe, for example, 15th of November 2017 then you would use the following command:

# Details from the 15th of the month starting from 10:00:00.
atop –r 20171115 –b 10:00


Afterwards, you can jump forward 10 minutes in time using the ‘t’ key or ‘T’ to go back 10 minutes. The button ‘b’ can be used to set a specific timeframe.

Atop mini cheat sheet

You can sort with the following hotkeys within atop:

* General g
* Memory m
* Network n
* Disk d


Want to learn more?
More information about these tools can be find in the man pages.




General FAQ

Show all FAQs

OpenStack FAQ

Show all FAQs


Show all FAQs