Use Sar To Monitor System Performance

Updated on January 27, 2016
Use Sar To Monitor System Performance header image

sar is a multi-purpose system performance monitoring utility which is part of the sysstat package. With sar, you can collect, report, or save various types of system activities such as CPU, RAM, I/O, Disk usage, etc.

In this article, we will be covering the process of installing and using sar to monitor system performance.


  • An instance running CentOS 7 x64.
  • A sudo user.

Installing the sysstat package

In order to use sar, you need to install the sysstat package. However, it is a good practice to first update your system’s packages if you haven’t done so in a while.

sudo yum update
sudo shutdown -r now

Download and install the latest stable version of sysstat from its official website:

cd ~
sudo yum install sysstat-11.2.0-1.x86_64.rpm

Launching the sysstat service

sudo systemctl enable sysstat
sudo systemctl start sysstat

Using sar to get system performance statistics

In short, the usage of the sar command is:

sar [ options ] [ <interval> [ <count> ] ]

The options of sar cover every nook and corner of the system, main options include:

-B                               Paging statistics
-b                               I/O and transfer rate statistics
-d                               Block devices statistics
-F [ MOUNT ]                     Filesystems statistics
-H                               Hugepages utilization statistics
-I { <int> | SUM | ALL | XALL }  Interrupts statistics
-m { <keyword> [,...] | ALL }    Power management statistics
-n { <keyword> [,...] | ALL }
-q                               Queue length and load average statistics
-R                               Memory statistics
-r [ ALL ]                       Memory utilization statistics
-S                               Swap space utilization statistics
-u [ ALL ]                       CPU utilization statistics
-v                               Kernel tables statistics
-W                               Swapping statistics
-w                               Task creation and system switching statistics
-y                               TTY devices statistics

For the purpose of this tutorial, we will be only covering some of the most common usage cases for sar.

Display the CPU performance for 4 times with the interval of 1 second:

sar 1 4


sar -u 1 4

By default, sar will display the CPU performance report if no parameters were specified.

Output the CPU performance statistics once per second until you press Ctrl-C to cancel:

sar 1

In this example, only the interval is specified, the number of repetitions is not.

Show performance statistics for CPU (-u), memory (-r), swap space (-S), and I/O (-d):

sar -urSbd 1

Show performance statistics for the network interface:

sar -n DEV 1

Save the statistics into a specified file ~/sar.log:

sar -u -r -o ~/sar.log 1


sar is a versatile command, only a few of its usage examples are mentioned in this article. You can learn more about it by inputting sar -h or visiting its official home page.

Thank you for reading.