SAR – Linux System Performance Monitoring Tool (Check Linux System Activity Report Using the SAR Command)

The sar stands for “System Activity Report”, which is used to collect, report or store system activity information.

It is a system performance monitoring command that is used to report various system performance metrics such as average CPU activity, individual CPU activity, memory used & available, device load, network, etc,.

The sar command is part of the sysstat package, which is not already installed on most Linux systems. Therefore, it can be installed using the associated distribution package manager.

If you want to get the average CPU or average memory usage report from the SAR report, go to the following article.

The sar command is one of the best tools for tracking historical system performance reports. Also, it allows you to investigate issues when you encounter performance problems on the system.

By default it collects performance data for a week. This period can be extended beyond one month. If the value exceeds 28, the log files are placed in multiple directories, one for each month.

To do so, make the changes in the /etc/sysconfig/sysstat file. Edit the sysstat file and change HISTORY=7 to HISTORY=XX.

The sar data files are located in the /var/log/sa directory by default. All data are captured in binary form and saved to a file (datafile).

The data files are named saDD or saYYYYMMDD, where YYYY stands for the current year, MM for the current month and DD for the current day.

The data can then be selectively displayed with the sar command using the -f option. The sar command reports system-wide statistics, if you doesn’t use -P flag.

SAR Command Store the below statistics:

  • Average & Individual CPU utilization, it shows percentage of CPU utilization by user level (application) and system level (kernel).
  • Total number of read/write requests issued to physical devices
  • Total amount of data read from the devices and written to devices in blocks.
  • Number of sectors read from the device and written to the device
  • Total number of packets, compressed packets, network packets, TCP packets, UDP packets, and kilobytes received and transmitted
  • Total number of bad and good packets received
  • Amount of free, used, buffers, and cache memory in kilobytes.
  • Percentage of used memory & swap space.
  • Amount of used & free swap space in kilobytes.
  • Percentage of time spent by the CPU for hardware interrupts, software interrupts, and virtual processor.
  • Percentage of time that the CPU were idle.
  • sadc: sadc stands for “system activity data collector”. It’s a backend tool that collects the data collection for sar.
  • sadf: It can generate sar report in CSV, XML, and various other formats. This will help you to integrate the sar report with other tools.

How To Install sysstat in Linux

The sysstat package is available in all Linux distribution repositories and can be easily installed with the help of the package manager.

For Fedora system, use DNF Command to install sysstat.

$ sudo dnf install sysstat

For Debian/Ubuntu systems, use APT-GET Command or APT Command to install sysstat.

$ sudo apt install sysstat

For Arch Linux based systems, use Pacman Command to install sysstat.

$ sudo pacman -S sysstat

For RHEL/CentOS systems, use YUM Command to install sysstat.

$ sudo yum install sysstat

For openSUSE Leap system, use Zypper Command to install sysstat.

$ sudo zypper install sysstat

The sar data file is located in the below location on RHEL based systems such as Red Hat, Fedora and CentOS.

/var/log/sa

The sar data file is located in the below location on Debian based systems such as Debian, Ubuntu and LinuxMint.

/var/log/sysstat/

The sysstat config file is located in the below location on RHEL based systems such as Red Hat, Fedora and CentOS.

/etc/sysconfig/sysstat

The sysstat config file is located in the below location on Debian based systems such as Debian, Ubuntu and LinuxMint. Also, set ENABLED to true.

/etc/default/sysstat

By default, it drops a cronjob file for sysstat in the below location and it will run every 10 minutes to collects sar data for historical reference.

# cat /etc/cron.d/sysstat

# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A
  • /usr/lib64/sa/sa1 1 1: This cron job runs every 10 minutes and collects 1 report with 1 second interval. It can’t be viewable by a text editor.
  • /usr/lib64/sa/sa2 -A: This cron job runs every day midnight (at 23:53) to create the daily summary report of the sar data. It can be viewable by a text editor. Also, it purges the data older than a particular number of days.

1) How to Check the CPU Usage Report of the System Using the sar Command

The below sar command shows today’s CPU report statistics. This is the average of all CPUs.

It shows the percentage of CPU utilization for user application, nice priority and system application.

Furthermore, it shows the percentage of time that the CPU were idle with outstanding disk I/O request and without any outstanding disk I/O request.

# sar
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all     15.78      0.02      2.23      0.03      1.04     80.90
12:20:01 AM     all     15.04      0.02      2.00      0.03      0.41     82.52
12:30:01 AM     all      8.98      0.02      1.55      0.02      0.84     88.59
12:40:01 AM     all     12.05      0.02      1.79      0.03      0.71     85.40
12:50:01 AM     all     10.87      0.04      1.89      0.05      0.51     86.65
01:00:01 AM     all     11.70      0.02      1.95      0.02      0.74     85.57
01:10:01 AM     all     10.35      0.08      1.74      0.10      1.00     86.73
01:20:01 AM     all     17.97      0.02      2.62      1.23      0.87     77.28
01:30:01 AM     all      9.39      0.02      1.55      0.03      0.42     88.59
01:40:01 AM     all     12.43      0.03      1.71      0.07      0.42     85.34
01:50:01 AM     all     10.52      0.08      1.82      0.21      0.58     86.79
02:00:01 AM     all      8.66      0.02      1.60      0.06      0.94     88.74
02:10:01 AM     all     10.86      0.02      1.72      0.05      1.99     85.37
02:20:01 AM     all      9.02      0.02      1.53      0.05      1.23     88.16
02:30:01 AM     all     11.03      0.03      1.73      0.03      1.02     86.15
02:40:01 AM     all     13.71      0.02      2.21      0.03      1.30     82.74
02:50:02 AM     all     48.72      0.02      3.35      0.03      1.26     46.63
03:00:01 AM     all     24.13      0.02      3.30      0.02      0.93     71.60
03:10:01 AM     all     25.57      0.08      3.98      0.10      1.49     68.78
.
.

2) How to Check the System’s Memory Usage Report Using the sar Command

The below sar command shows today’s Memory report statistics for the system.

It shows the amount of free and available memory in kilobytes, amount of memory used as buffers and cache data by the kernel, amount of memory & percentage of memory needed for current workload, and percentage of used memory.

# sar -r
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
12:10:01 AM   1096496   2783884     71.74      2112   1036136   2982504     60.51   1375696   1062032       384
12:20:01 AM   1206696   2673684     68.90      2228   1050604   2606256     52.88   1264328   1067880       376
12:30:01 AM   1441240   2439140     62.86      2284   1060880   2207384     44.78   1028920   1074164        16
12:40:01 AM   1291932   2588448     66.71      2364   1105092   2325504     47.18   1185668   1062000       360
12:50:01 AM   1111376   2769004     71.36      2468   1124044   2528756     51.30   1340708   1076772       392
01:00:01 AM    722224   3158156     81.39      2508   1137760   3732744     75.73   1703060   1086764       244
01:10:01 AM    898320   2982060     76.85      2576   1202204   2940436     59.66   1493416   1130032       280
01:20:01 AM    537384   3342996     86.15      3712   1638048   2465396     50.02   1491588   1385284       284
01:30:01 AM    661500   3218880     82.95      3780   1634768   2300292     46.67   1400244   1357284       192
01:40:01 AM    725344   3155036     81.31      1928    781496   4257244     86.37   1647232   1045528       100
01:50:01 AM   1337576   2542804     65.53      1992    978496   2327924     47.23   1123948    982476       152
02:00:01 AM   1145164   2735216     70.49      2072   1009748   2709556     54.97   1296000    995320       556
02:10:01 AM   1293708   2586672     66.66      2200   1033304   2325832     47.19   1143956   1004436       332
02:20:01 AM   1167928   2712452     69.90      2276   1053428   2525596     51.24   1257128   1012684       232
02:30:01 AM   1214484   2665896     68.70      2316   1066964   2373368     48.15   1206780   1019636       224
.
.

3) How to Check the System’s CPU Usage Report Only for 3 Times with 1 Second Interval Using sar Command

The below sar command shows the system’s CPU report statistics only for 3 times with one second interval.

# sar 1 3
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

10:14:43 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
10:14:44 PM     all      1.00      0.00      2.00      0.00      0.00     97.00
10:14:45 PM     all     17.68      0.00      6.06      0.00      0.51     75.76
10:14:46 PM     all      3.54      0.00      7.07      0.51      0.00     88.89
Average:        all      7.38      0.00      5.03      0.17      0.17     87.25

4) How to Check the Individual Usage Report of Each CPU of the System Using the sar Command

It shows each individual CPU usage when using the -P flag with sar command.

# sar -P ALL
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all     15.78      0.02      2.23      0.03      1.04     80.90
12:10:01 AM       0     14.18      0.03      2.12      0.02      1.05     82.58
12:10:01 AM       1     17.37      0.00      2.34      0.03      1.03     79.22

12:10:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:20:01 AM     all     15.04      0.02      2.00      0.03      0.41     82.52
12:20:01 AM       0     14.05      0.00      2.00      0.03      0.44     83.48
12:20:01 AM       1     16.03      0.03      1.99      0.03      0.37     81.55

12:20:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:30:01 AM     all      8.98      0.02      1.55      0.02      0.84     88.59
12:30:01 AM       0      8.74      0.03      1.60      0.02      0.83     88.78
12:30:01 AM       1      9.23      0.00      1.50      0.02      0.86     88.39
.
.

5) How to Check the Usage of the Specific CPU of the System Using the sar Command

The below sar command shows the usage statistics of the specific CPU instead of all.

# sar -P 1
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM       1     17.37      0.00      2.34      0.03      1.03     79.22
12:20:01 AM       1     16.03      0.03      1.99      0.03      0.37     81.55
12:30:01 AM       1      9.23      0.00      1.50      0.02      0.86     88.39
12:40:01 AM       1     13.34      0.00      1.82      0.03      0.68     84.13
12:50:01 AM       1     11.47      0.01      1.90      0.04      0.49     86.10
01:00:01 AM       1     12.55      0.00      1.94      0.02      0.72     84.78
01:10:01 AM       1     10.98      0.01      1.79      0.04      0.93     86.24
01:20:01 AM       1     17.90      0.01      2.50      0.75      0.82     78.02
01:30:01 AM       1     10.33      0.03      1.61      0.03      0.41     87.60
01:40:01 AM       1     13.27      0.04      1.75      0.05      0.43     84.47
01:50:01 AM       1     10.93      0.12      1.84      0.25      0.56     86.31
.
.

6) How to Check the System’s CPU Usage Report with Additional Fields

The below sar command shows the output with few additional fields.

# sar -u ALL
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
12:10:01 AM     all     15.78      0.02      2.21      0.03      1.04      0.00      0.02      0.00      0.00     80.90
12:20:01 AM     all     15.04      0.02      1.98      0.03      0.41      0.00      0.02      0.00      0.00     82.52
12:30:01 AM     all      8.98      0.02      1.53      0.02      0.84      0.00      0.02      0.00      0.00     88.59
12:40:01 AM     all     12.05      0.02      1.78      0.03      0.71      0.00      0.02      0.00      0.00     85.40
12:50:01 AM     all     10.87      0.04      1.87      0.05      0.51      0.00      0.02      0.00      0.00     86.65
01:00:01 AM     all     11.70      0.02      1.94      0.02      0.74      0.00      0.02      0.00      0.00     85.57
01:10:01 AM     all     10.35      0.08      1.73      0.10      1.00      0.00      0.01      0.00      0.00     86.73
01:20:01 AM     all     17.97      0.02      2.60      1.23      0.87      0.00      0.03      0.00      0.00     77.28
01:30:01 AM     all      9.39      0.02      1.54      0.03      0.42      0.00      0.01      0.00      0.00     88.59
01:40:01 AM     all     12.43      0.03      1.69      0.07      0.42      0.00      0.02      0.00      0.00     85.34
01:50:01 AM     all     10.52      0.08      1.80      0.21      0.58      0.00      0.02      0.00      0.00     86.79
02:00:01 AM     all      8.66      0.02      1.58      0.06      0.94      0.00      0.01      0.00      0.00     88.74
02:10:01 AM     all     10.86      0.02      1.69      0.05      1.99      0.00      0.02      0.00      0.00     85.37
02:20:01 AM     all      9.02      0.02      1.51      0.05      1.23      0.00      0.02      0.00      0.00     88.16
.
.

7) How to Check the System Swap Space Usage Report

The below sar command shows the usage statistics of swap space.

# sar -S
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
12:10:01 AM    766972    281600     26.86     81176     28.83
12:20:01 AM    766972    281600     26.86     81176     28.83
12:30:01 AM    766972    281600     26.86     81188     28.83
12:40:01 AM    766972    281600     26.86     81188     28.83
12:50:01 AM    766972    281600     26.86     81616     28.98
01:00:01 AM    766972    281600     26.86     81616     28.98
01:10:01 AM    766972    281600     26.86     81616     28.98
01:20:01 AM    766136    282436     26.94     81544     28.87
01:30:01 AM    765880    282692     26.96     81544     28.85
01:40:01 AM    765368    283204     27.01     81528     28.79
01:50:01 AM    765368    283204     27.01     81528     28.79
02:00:01 AM    765368    283204     27.01     81528     28.79
02:10:01 AM    765368    283204     27.01     81528     28.79
02:20:01 AM    765368    283204     27.01     81528     28.79
.
.

8) How to Check the System’s Other Memory Statistic Usage Report

The below sar command shows the usage memory statistics report such as number of memory pages freed and cached by the system per second.

Also, it shows how much memory pages used as buffers.

# sar -R
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM   frmpg/s   bufpg/s   campg/s
12:10:01 AM    -54.61      0.04      5.71
12:20:01 AM     45.94      0.05      6.03
12:30:01 AM     97.63      0.02      4.28
12:40:01 AM    -62.25      0.03     18.43
12:50:01 AM    -75.17      0.04      7.89
01:00:01 AM   -162.22      0.02      5.72
01:10:01 AM     73.42      0.03     26.87
01:20:01 AM   -150.86      0.47    182.17
01:30:01 AM     51.65      0.03     -1.36
01:40:01 AM     26.63     -0.77   -355.85
01:50:01 AM    255.21      0.03     82.12
02:00:01 AM    -80.10      0.03     13.01
02:10:01 AM     61.86      0.05      9.81
.
.

9) How to Check the System’s Paging Statistics Usage Report

It reports variety of paging statistics.

# sar -B
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
12:10:01 AM     21.17     51.77   9912.40      0.11   6981.65      0.00      0.00      0.00      0.00
12:20:01 AM     21.19     44.22   9219.85      0.10   6726.94      0.00      0.00      0.00      0.00
12:30:01 AM     13.76     41.11   7322.54      0.12   5594.25      0.00      0.00      0.00      0.00
12:40:01 AM     71.59     62.27   8263.25      0.08   6227.19      0.00      0.00      0.00      0.00
12:50:01 AM     37.58     71.72   8564.99      0.09   6247.99      0.00      0.00      0.00      0.00
01:00:01 AM      6.11     45.79   9290.86      0.08   6579.60      0.00      0.00      0.00      0.00
01:10:01 AM    106.74    103.99   7225.51      1.57   5376.08      0.00      0.00      0.00      0.00
01:20:01 AM   2364.06    299.32  10791.43      0.94   8633.49    407.43      6.06    411.15     99.43
01:30:01 AM     30.86     44.87   6460.40      0.13   4414.14      9.61      0.00      9.42     98.09
01:40:01 AM    121.70     51.03   7824.75      1.94   5776.08    334.12     55.04    387.63     99.61
01:50:01 AM    323.67     53.33   7880.70      4.55   6554.40      0.00      0.00      0.00      0.00
02:00:01 AM     48.10     42.55   7785.60      0.86   5630.40      0.00      0.00      0.00      0.00
02:10:01 AM     37.52     45.53   8377.43      0.46   5689.86      0.00      0.00      0.00      0.00
02:20:01 AM     30.37     42.24   7536.33      0.38   5482.80      0.00      0.00      0.00      0.00
02:30:01 AM     20.16     43.01   8409.41      0.24   6133.44      0.00      0.00      0.00      0.00
02:40:01 AM     23.62     45.69  11735.93      0.12   8866.95      0.00      0.00      0.00      0.00
.
.

10) How to Check the Swapping Statistics Usage Report of the System

It shows the total number of swap pages the system brought in and brought out per second.

#  sar -W
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM  pswpin/s pswpout/s
12:10:01 AM      0.02      0.00
12:20:01 AM      0.00      0.00
12:30:01 AM      0.01      0.00
12:40:01 AM      0.00      0.00
12:50:01 AM      0.28      0.00
01:00:01 AM      0.00      0.00
01:10:01 AM      0.00      0.00
01:20:01 AM      0.01      0.43
01:30:01 AM      0.00      0.03
01:40:01 AM      0.00      0.27
01:50:01 AM      0.00      0.00
02:00:01 AM      0.00      0.00
.
.

11) How to Check the System’s Queue Length and Load Average Usage Report

It shows the number of tasks in queue and number of tasks in the task list.

Also, it shows the system load average for the past 1/5/15 mins.

# sar -q
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
12:10:01 AM         7       262      0.38      0.38      0.40         0
12:20:01 AM         5       251      0.58      0.38      0.39         0
12:30:01 AM         5       242      0.10      0.17      0.28         1
12:40:01 AM         8       246      0.04      0.20      0.28         0
12:50:01 AM         4       258      0.19      0.29      0.31         0
01:00:01 AM         6       281      0.56      0.32      0.32         1
01:10:01 AM         5       258      0.40      0.31      0.29         0
01:20:01 AM         5       252      0.62      0.47      0.38         0
01:30:01 AM         6       242      0.13      0.19      0.28         0
01:40:01 AM         5       287      1.33      0.49      0.33         3
01:50:01 AM         4       242      0.16      0.26      0.30         0
.
.

12) How to Check the I/O and Transfer Rate Statistics Usage Report of the System

It reports many statistics about reading and writing requests against physical devices and blocks.

# sar -b
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM       tps      rtps      wtps   bread/s   bwrtn/s
12:10:01 AM      5.62      0.51      5.11     42.34    101.64
12:20:01 AM      5.26      0.51      4.75     42.35     86.44
12:30:01 AM      4.39      0.28      4.11     25.20     81.09
12:40:01 AM      7.91      1.58      6.33    145.50    122.96
12:50:01 AM     10.41      2.81      7.60     75.15    141.37
01:00:01 AM      5.01      0.16      4.85     12.22     90.79
01:10:01 AM     14.75      3.58     11.18    213.47    206.61
01:20:01 AM    119.80     99.05     20.75   4721.80    572.13
01:30:01 AM      5.39      0.55      4.85     61.72     88.52
01:40:01 AM      9.73      4.49      5.24    243.39     99.37
01:50:01 AM     16.51     11.31      5.20    647.33    105.48
.
.

13) How to Check an Each Block Device Statistics Usage Report

It especially report only about block device statistics.

# sar -d
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
12:10:01 AM  dev253-0      5.62     42.34    101.64     25.62      0.01      1.30      0.19      0.11
12:20:01 AM  dev253-0      5.26     42.35     86.44     24.51      0.01      1.25      0.17      0.09
12:30:01 AM  dev253-0      4.39     25.20     81.09     24.23      0.00      1.10      0.16      0.07
12:40:01 AM  dev253-0      7.91    145.50    122.96     33.93      0.01      1.68      0.22      0.17
12:50:01 AM  dev253-0     10.41     75.15    141.37     20.80      0.01      1.49      0.22      0.23
01:00:01 AM  dev253-0      5.01     12.22     90.79     20.57      0.01      1.35      0.14      0.07
01:10:01 AM  dev253-0     14.75    213.47    206.61     28.47      0.01      1.10      0.19      0.28
01:20:01 AM  dev253-0    119.80   4721.80    572.13     44.19      0.09      0.90      0.27      3.20
01:30:01 AM  dev253-0      5.39     61.72     88.52     27.87      0.01      1.18      0.18      0.10
.
.

14) How to Check the System’s Network Statistics Usage Report

Use the -n flag followed by network keywords to generate various of network statistics reports.

List of Keyword’s available for Network Statistics:

  • DEV: Displays network devices vital statistics for eth0, eth1, etc.,
  • EDEV: Display network device failure statistics
  • NFS: Displays NFS client activities
  • NFSD: Displays NFS server activities
  • SOCK: Displays sockets in use for IPv4
  • IP: Displays IPv4 network traffic
  • EIP: Displays IPv4 network errors
  • ICMP: Displays ICMPv4 network traffic
  • EICMP: Displays ICMPv4 network errors
  • TCP: Displays TCPv4 network traffic
  • ETCP: Displays TCPv4 network errors
  • UDP: Displays UDPv4 network traffic
  • For IPv6: Use the following keywords such as SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6
  • ALL This displays all of the above information. The output will be very long.
# sar -n DEV
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
12:10:01 AM      eth0     30.42     32.23      3.98     52.63      0.00      0.00      0.00
12:10:01 AM      eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:10:01 AM      eth2      0.47      0.38      0.27      0.05      0.00      0.00      0.00
12:10:01 AM        lo      3.24      3.24      0.49      0.49      0.00      0.00      0.00
12:20:01 AM      eth0     25.15     26.93      5.55     35.87      0.00      0.00      0.00
12:20:01 AM      eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:20:01 AM      eth2      0.25      0.14      0.05      0.02      0.00      0.00      0.00
12:20:01 AM        lo      2.91      2.91      0.45      0.45      0.00      0.00      0.00
12:30:01 AM      eth0     20.38     20.23      2.13     27.53      0.00      0.00      0.00
12:30:01 AM      eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:30:01 AM      eth2      0.27      0.16      0.06      0.03      0.00      0.00      0.00
12:30:01 AM        lo      3.00      3.00      0.54      0.54      0.00      0.00      0.00
.
.

15) How to Check All Statistical Reports in One Go

Use the -n flag with sar command to print all statistical reports in one page.

# sar -A
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   09/15/2019        _x86_64_        (24 CPU)

00:00:01        CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest     %idle
00:10:01        all      0.63      0.00      0.51      0.00      0.00      0.00      0.00      0.00     98.86
00:10:01          0      6.74      0.00      6.85      0.01      0.00      0.00      0.00      0.00     86.41
00:10:01          1      2.60      0.00      1.06      0.00      0.00      0.00      0.01      0.00     96.33
00:10:01          2      0.12      0.00      0.22      0.00      0.00      0.00      0.00      0.00     99.66
00:10:01          3      0.01      0.00      0.47      0.00      0.00      0.00      0.00      0.00     99.52

00:00:01       proc/s   cswch/s
00:10:01         1.56    735.00
00:20:01         1.27    639.06
00:30:01         1.09    558.03
00:40:01         1.11    567.85

00:00:01     pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
00:10:01         0.01     39.72    257.57      0.00    312.53      0.00     20.71     15.37     74.23
00:20:01         0.00     33.74    215.12      0.00    259.87      0.00     19.05     13.66     71.71
01:10:01         0.17     32.58    198.67      0.00    481.79      0.00     18.74     13.66     72.93
01:20:01         0.01     33.76    162.81      0.00   1163.93      0.00     18.31     11.96     65.31
Average:         0.75     45.24    600.90      0.01    571.43      0.00     38.14     24.07     63.12

00:00:01          tps      rtps      wtps   bread/s   bwrtn/s
00:10:01         3.72      0.00      3.72      0.01     79.43
00:20:01         3.32      0.00      3.32      0.00     67.48
00:40:01         3.05      0.00      3.05      0.00     59.97
00:50:01         3.29      0.00      3.28      0.01     65.94
Average:         4.21      0.05      4.17      1.50     90.49

00:00:01      frmpg/s   bufpg/s   campg/s
00:10:01        16.31      0.01    -15.78
00:20:01         9.90      0.01    -13.26
00:40:01         7.42      0.01     -6.50
00:50:01         6.47      0.01     -8.20
Average:        23.76     -0.76    -22.76

00:00:01    kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
00:10:01     19790964  13078780     39.79    348308  11143544   1470340      3.98
00:20:01     19814700  13055044     39.72    348336  11111736   1472000      3.98
01:00:01     19910460  12959284     39.43    348424  11013716   1475892      3.99
15:40:01     25107780   7761964     23.61    177104   6052260   1491936      4.04
Average:     21784951  11084793     33.72    272699   9195659   1565368      4.23

00:00:01    kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
00:10:01      4095992         0      0.00         0      0.00
00:20:01      4095992         0      0.00         0      0.00
01:00:01      4095992         0      0.00         0      0.00
15:40:01      4095992         0      0.00         0      0.00
Average:      4095992         0      0.00         0      0.00

00:00:01    dentunusd   file-nr  inode-nr    pty-nr
00:10:01      1647354      1248    240094        58
00:20:01      1647510      1200    240249        58
01:20:01      1648621      1296    239945        58
15:40:01      1667769      1440    240823        61
Average:      1656701      1321    240782        59

00:00:01      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
00:10:01            0       455      0.11      0.06      0.05
00:20:01            0       455      0.00      0.02      0.01
00:30:01            0       455      0.01      0.05      0.01
01:10:01            1       458      0.18      0.07      0.01
15:40:01            0       457      0.18      0.16      0.17
Average:            0       459      0.11      0.09      0.05

00:00:01          TTY   rcvin/s   xmtin/s framerr/s prtyerr/s     brk/s   ovrun/s
00:10:01            0      0.00      0.00      0.00      0.00      0.00      0.00
00:10:01            1      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01            0      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01            1      0.00      0.00      0.00      0.00      0.00      0.00
Average:            0      0.00      0.00      0.00      0.00      0.00      0.00
Average:            1      0.00      0.00      0.00      0.00      0.00      0.00

00:00:01          DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
00:10:01       dev8-0      3.72      0.01     79.43     21.33      0.00      0.23      0.08      0.03
00:20:01       dev8-0      3.32      0.00     67.48     20.32      0.00      0.20      0.09      0.03
01:30:01       dev8-0      3.12      0.00     62.45     20.04      0.00      0.22      0.10      0.03
15:30:01       dev8-0      6.80      0.35    155.47     22.92      0.00      0.67      0.19      0.13
15:40:01       dev8-0      4.95      0.16    112.86     22.82      0.00      0.49      0.16      0.08
Average:       dev8-0      4.21      1.50     90.49     21.83      0.00      0.53      0.19      0.08

00:00:01        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
00:10:01           lo      0.02      0.02      0.00      0.00      0.00      0.00      0.00
00:10:01         eth0     27.99     37.17      6.76     37.22      0.00      0.00      0.00
00:10:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01           lo      0.31      0.31      0.03      0.03      0.00      0.00      0.00
15:40:01         eth0     36.69     51.32      9.70     51.80      0.00      0.00      0.00
15:40:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:           lo      0.21      0.21      0.02      0.02      0.00      0.00      0.00
Average:         eth0     73.99    140.18     10.40    179.80      0.00      0.00      0.00
Average:         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00

00:00:01        IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
00:10:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:10:01         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:10:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

00:00:01       call/s retrans/s    read/s   write/s  access/s  getatt/s
00:10:01         0.00      0.00      0.00      0.00      0.00      0.00
00:20:01         0.00      0.00      0.00      0.00      0.00      0.00
15:30:01         0.00      0.00      0.00      0.00      0.00      0.00
15:40:01         0.00      0.00      0.00      0.00      0.00      0.00
Average:         0.00      0.00      0.00      0.00      0.00      0.00

00:00:01      scall/s badcall/s  packet/s     udp/s     tcp/s     hit/s    miss/s   sread/s  swrite/s saccess/s sgetatt/s
00:10:01         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:20:01         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
15:40:01         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

00:00:01       totsck    tcpsck    udpsck    rawsck   ip-frag    tcp-tw
00:10:01          222        18         3         0         0        41
00:20:01          221        18         3         0         0        35
15:30:01          227        19         3         0         0        58
15:40:01          223        19         3         0         0        47
Average:          228        19         3         0         0        42

16) How to Check the Context Switches Statistics Usage Report of the System

It shows context switches statistics usage report.

# sar -w
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/15/2019 	_x86_64_	(2 CPU)

12:00:02 AM    proc/s   cswch/s
12:10:01 AM      1.59   1324.05
12:20:01 AM      1.46   1232.72
12:30:01 AM      1.26   1119.66
12:40:01 AM      1.39   1108.91
12:50:01 AM      2.04   1211.01
01:00:01 AM      1.58   1617.52
01:10:01 AM      1.16   1162.67
01:20:01 AM      2.23   1402.36
01:30:01 AM      1.16    922.19
01:40:01 AM      1.16    985.53
.
.

17) How to Check the CPU Statistics Usage Report of the System for a Specified Date

Use the specific date data file followed by the -f flag as described in the below example to verify the old sar report.

# sar -f /var/log/sa/sa14
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/14/2019 	_x86_64_	(2 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:02 AM     all     44.71      0.02      4.90      0.01      0.47     49.89
12:20:01 AM     all     54.23      0.02      5.26      0.01      0.37     40.11
12:30:02 AM     all     55.31      0.02      5.19      0.01      0.51     38.97
12:40:01 AM     all     58.54      0.04      5.42      0.04      0.38     35.60
12:50:01 AM     all     38.27      0.02      4.54      0.08      0.65     56.44
01:00:02 AM     all     35.18      0.02      4.07      0.04      0.80     59.89
01:10:01 AM     all     42.59      0.09      4.84      0.09      0.63     51.75
01:20:01 AM     all     42.41      0.02      5.29      1.10      0.72     50.46
01:30:01 AM     all     39.30      0.04      4.37      0.04      0.70     55.56
01:40:02 AM     all     39.68      0.02      4.95      0.06      0.73     54.57
.
.

18) How to Check the Memory Statistics Usage Report of the System for a Specified Date

This is similar to the above, but it shows the memory statistics report instead of the CPU.

# sar -r -f /var/log/sa/sa14
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/14/2019 	_x86_64_	(2 CPU)

12:00:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
12:10:02 AM   1236132   2644248     68.14      2536   1121188   2384264     48.37   1205072   1101060       156
12:20:01 AM   1230076   2650304     68.30      2668   1128424   2381856     48.32   1214600   1097656       284
12:30:02 AM   1075000   2805380     72.30      2716   1138392   2678532     54.34   1370204   1092268       384
12:40:01 AM    784240   3096140     79.79      2776   1202592   3219600     65.32   1660800   1081392       448
12:50:01 AM   1049564   2830816     72.95       956   1127024   2642776     53.62   1388296   1092076       176
01:00:02 AM   1160176   2720204     70.10       268   1038152   2585044     52.45   1306164   1064044       188
01:10:01 AM   1371420   2508960     64.66       308    941004   2399556     48.68   1023704   1144964       616
01:20:01 AM    974900   2905480     74.88      3532   1200116   2483496     50.39   1252904   1188676       316
01:30:01 AM    957468   2922912     75.33      3764   1243072   2416848     49.03   1256640   1204924       176
01:40:02 AM    714984   3165396     81.57      3736    919856   3804280     77.18   1651632   1039264       516
01:50:02 AM   1467292   2413088     62.19      1992    766868   2443844     49.58   1050688    911688       236
.
.

19) How to Check the System Activity Report for a Specified Time

This is similar to the above, but it shows the requested statistical report from the specified time.

# sar -f /var/log/sa/sa14 -s 22:00:00
Linux 3.10.0-957.27.2.el7.x86_64 (centos.2daygeek.com) 	09/14/2019 	_x86_64_	(2 CPU)

10:00:02 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
10:10:02 PM     all     25.46      0.02      3.37      0.01      0.40     70.74
10:20:01 PM     all     26.18      0.03      3.44      0.01      0.33     70.01
10:30:01 PM     all     26.44      0.02      4.08      0.01      0.47     68.98
10:40:01 PM     all     33.24      0.02      4.03      0.02      0.60     62.09
10:50:01 PM     all     28.98      0.02      3.52      0.02      0.52     66.94
11:00:01 PM     all     28.28      0.02      3.61      0.03      0.48     67.59
11:10:01 PM     all     27.29      0.10      3.58      0.06      0.74     68.22
11:20:01 PM     all     19.35      0.02      2.75      0.03      0.43     77.42
11:30:01 PM     all     13.34      0.01      1.66      0.02      0.56     84.42
11:40:01 PM     all     19.08      0.02      2.55      0.02      0.41     77.93
11:50:01 PM     all     17.58      0.02      2.21      0.03      0.59     79.58
Average:        all     24.10      0.03      3.16      0.02      0.50     72.18
.
.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...