SAR – Linux System Performance Monitoring Tool (Check Server Activity Logs Using SAR Command)

1) What is sar ?

SAR stands for System Activity Report is a system monitor command used to report on various system activity, like Average CPU activity, Individual CPU activity, memory used & available, device load, network, etc.

SAR command is part of the Linux systat package. Also we can call this as Linux system performance data collector.

Linux sar command is one of the best tool to monitor the system performance and to investigate the bottlenecks. Every server administrator aware of sar command and it’s usage to check server performance whenever server performance goes down or critical situation.

SAR command Monitor/Store the below reports.

  • Average CPU Usage
  • Individual CPU Usage
  • Memory Usage (Used & Available)
  • Swap Space Usage (Used & Available)
  • Average I/O activities of the system
  • Individual device I/O activities
  • Context switch statistics
  • Run queue and load average data
  • Network statistics
  • Report sar data from a specific time

If you don’t know about sar command and their usage, don’t worry about it because we are going to write each and every options and activity about sar command. Once if you read out this article, i make sure that you will understand 100% about sar because when i start writing this article i have fixed in mind that even starters/beginners can also understand this article.

Install Sysstat in Linux

There is no separate package for sar on Linux. It’s bundled with sysstat package and available in most of the distribution default repository. If it’s not installed, just fire the following command based on your distribution.

[Install vmstat on CentOS/RHEL]
$ sudo yum install sysstat

[Install vmstat on Fedora]
$ sudo dnf install sysstat

[Install vmstat on Debian/Ubuntu]
$ sudo apt-get install sysstat

[Install vmstat on Arch Linux]
$ sudo pacman -S sysstat

[Install vmstat on Mageia]
$ sudo urpmi sysstat

[Install vmstat on openSUSE]
$ sudo zypper install sysstat

Before digging about sar, we need to know which location is sar data file stored and how it will be work.
sa logs location on Linux

[sa logs location @ (RHEL/CentOS/Fedora)]
$ /var/log/sa

[sa logs location @ (Debian/Ubuntu)]
$ /var/log/sysstat/

sysstat config file location on Linux

[sa logs location @ (RHEL/CentOS/Fedora)]
$ /etc/sysconfig/sysstat

[sa logs location @ (Debian/Ubuntu)]
$ /etc/sysstat/config

sa log entries.

For your reference, i have listed the sa log entries from our RHEL 6.x system.

# ll -h
total 13M
drwxr-xr-x. 2 root root 4.0K Dec 12 00:00 ./
drwxr-xr-x. 9 root root 4.0K Dec 12 06:02 ../
-rw-r--r--. 1 root root 363K Dec  5 23:50 sa05
-rw-r--r--. 1 root root 363K Dec  6 23:50 sa06
-rw-r--r--. 1 root root 363K Dec  7 23:50 sa07
-rw-r--r--. 1 root root 363K Dec  8 23:50 sa08
-rw-r--r--. 1 root root 363K Dec  9 23:50 sa09
-rw-r--r--. 1 root root 363K Dec 10 23:50 sa10
-rw-r--r--. 1 root root 363K Dec 11 23:50 sa11
-rw-r--r--. 1 root root  97K Dec 12 06:10 sa12
-rw-r--r--. 1 root root 355K Dec  5 23:53 sar05
-rw-r--r--. 1 root root 355K Dec  6 23:53 sar06
-rw-r--r--. 1 root root 355K Dec  7 23:53 sar07
-rw-r--r--. 1 root root 355K Dec  8 23:53 sar08
-rw-r--r--. 1 root root 355K Dec  9 23:53 sar09
-rw-r--r--. 1 root root 355K Dec 10 23:53 sar10
-rw-r--r--. 1 root root 355K Dec 11 23:53 sar11

systat config file.

By default the data will be retained for a week retroactively in the default configuration. This duration can be increased to 28 days by modifying the HISTORY=n values.

# cat /etc/sysconfig/sysstat

# sysstat-9.0.4 configuration file.

# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=7

# Compress (using gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=31

# Parameters for the system activity data collector (see sadc manual page)
# which are used for the generation of log files.
SADC_OPTIONS="-S DISK"

Cron details for sysstat file.

The sysstat file was run via cron on every 10 minutes and 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

  • This runs every 10 minutes and collects sar data for historical reference.
  • This writes the data to /var/log/sa/saXX file. XX is the day of the month (Like today (12-Dec-2013)sa1 writes the sar data to /var/log/sa/sa12). saXX file is a binary file. You cannot view its content by opening it in a text editor.
  • In the above crontab example: sa1 1 1 means that sa1 collects sar data 1 time with 1 second interval (for every 10 mins).

/usr/lib64/sa/sa2

  • This runs everyday @ midnight (at 23:53) to create the daily summary report of the sar data.
  • sa2 creates /var/log/sa/sarXX file. This sarXX file created by sa2 is an ascii file that you can view it in a text editor.
  • In the above crontab example: sa1 1 1 means that sa1 collects sar data 1 time with 1 second interval (for every 10 mins).

1) To Print current date CPU report.

To check current date output, use sar without any parameter. The output is showing current date report with 10 mins interval because it will collect the data every 10 mins.

# sar -u
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

00:00:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
00:10:01        all      0.63      0.00      0.51      0.00      0.00     98.86
00:20:01        all      0.53      0.00      0.42      0.00      0.00     99.05
00:30:01        all      0.45      0.00      0.36      0.00      0.00     99.19
.
.
.
11:10:01        all      1.64      0.00      1.06      0.00      0.00     97.31
11:20:01        all      1.40      0.00      0.99      0.00      0.00     97.60
11:30:01        all      1.16      0.00      0.72      0.00      0.00     98.12
11:40:01        all      0.90      0.00      0.63      0.00      0.00     98.46
11:50:01        all      0.55      0.00      0.41      0.00      0.00     99.04
Average:        all      0.74      0.00      0.55      0.00      0.00     98.71

Details of SAR command output.

%user: The “user” column showing how long the processor is spending each process.
%nice: This was used to change the process priority.
%sys: This is shows how long & how much of percentage processor for spend operating system tasks.
%iowait: How long the processer is waiting for devices(input and output)
%steal: How much of resources virtualized from the physical CPU.
%idle: How long the processor is idle.

2) To Print current date CPU report every 1 second for 3 times.

The below command is print the CPU report every 1 second for 3 times because we have mentioned to print only 3 results.

# sar -u 1 3
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

11:56:58        CPU     %user     %nice   %system   %iowait    %steal     %idle
11:56:59        all      1.83      0.00      1.62      0.04      0.00     96.50
11:57:00        all      0.13      0.00      0.08      0.00      0.00     99.79
11:57:01        all      0.04      0.00      0.08      0.00      0.00     99.87
Average:        all      0.67      0.00      0.60      0.01      0.00     98.72

3) To Print current date CPU report with all fields.

This same as “sar -u” but displays additional fields

# sar -u ALL
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _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:20:01        all      0.53      0.00      0.42      0.00      0.00      0.00      0.00      0.00     99.05
00:30:01        all      0.45      0.00      0.36      0.00      0.00      0.00      0.00      0.00     99.19
00:40:01        all      0.47      0.00      0.36      0.00      0.00      0.00      0.00      0.00     99.17
00:50:01        all      0.46      0.00      0.36      0.00      0.00      0.00      0.00      0.00     99.18
.
.
10:50:01        all      0.91      0.00      0.71      0.00      0.00      0.00      0.00      0.00     98.38
11:00:01        all      1.27      0.00      0.95      0.00      0.00      0.00      0.00      0.00     97.78
11:10:01        all      1.64      0.00      1.05      0.00      0.00      0.00      0.00      0.00     97.31
11:20:01        all      1.40      0.00      0.99      0.00      0.00      0.00      0.00      0.00     97.60
11:30:01        all      1.16      0.00      0.72      0.00      0.00      0.00      0.00      0.00     98.12
11:40:01        all      0.90      0.00      0.63      0.00      0.00      0.00      0.00      0.00     98.46
11:50:01        all      0.55      0.00      0.41      0.00      0.00      0.00      0.00      0.00     99.04
Average:        all      0.74      0.00      0.55      0.00      0.00      0.00      0.00      0.00     98.71

4) To Print current date all CPU report with Individual CPU or Core usage.

Our server having 24 CPU’s, so i can see all the CPU outputs from 0 to 23.

# sar -P ALL
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

11:50:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
12:00:01        all      0.66      0.00      0.49      0.01      0.00     98.85
12:00:01          0      6.10      0.00      5.92      0.05      0.00     87.93
12:00:01          1      2.54      0.00      0.92      0.02      0.00     96.52
12:00:01          2      0.12      0.00      0.52      0.00      0.00     99.36
12:00:01          3      0.01      0.00      0.07      0.00      0.00     99.92
12:00:01          4      0.01      0.00      0.07      0.00      0.00     99.93
12:00:01          5      0.00      0.00      0.01      0.00      0.00     99.99
12:00:01          6      2.27      0.00      0.65      0.03      0.00     97.05
12:00:01          7      1.25      0.00      0.12      0.01      0.00     98.63
12:00:01          8      0.02      0.00      0.03      0.00      0.00     99.95
12:00:01          9      0.00      0.00      0.01      0.00      0.00     99.99
12:00:01         10      0.00      0.00      0.00      0.00      0.00    100.00
12:00:01         11      0.00      0.00      0.00      0.00      0.00    100.00
12:00:01         12      0.41      0.00      0.11      0.01      0.00     99.48
12:00:01         13      2.54      0.00      2.54      0.01      0.00     94.91
12:00:01         14      0.26      0.00      0.39      0.00      0.00     99.36
12:00:01         15      0.00      0.00      0.01      0.00      0.00     99.99
12:00:01         16      0.00      0.00      0.09      0.00      0.00     99.91
12:00:01         17      0.00      0.00      0.01      0.00      0.00     99.99
12:00:01         18      0.20      0.00      0.13      0.00      0.00     99.67
12:00:01         19      0.09      0.00      0.04      0.00      0.00     99.86
12:00:01         20      0.02      0.00      0.04      0.00      0.00     99.94
12:00:01         21      0.00      0.00      0.00      0.00      0.00    100.00
12:00:01         22      0.00      0.00      0.01      0.00      0.00     99.99
12:00:01         23      0.00      0.00      0.00      0.00      0.00    100.00

5) To Print current date CPU report with Particular CPU usage only.

Here i’m going to print the 1’st CPU usage.

# sar -P 1
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

00:00:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
00:10:01          1      2.60      0.00      1.07      0.00      0.00     96.33
00:20:01          1      2.12      0.00      0.52      0.00      0.00     97.36
00:30:01          1      1.83      0.00      0.52      0.00      0.00     97.64
00:40:01          1      1.69      0.00      0.23      0.00      0.00     98.07
00:50:01          1      2.06      0.00      0.34      0.00      0.00     97.61
.
.
12:30:01          1      1.34      0.00      0.48      0.01      0.00     98.18
12:40:01          1      1.51      0.00      0.44      0.01      0.00     98.05
12:50:01          1      1.63      0.00      0.58      0.01      0.00     97.78
13:00:01          1      2.28      0.00      0.99      0.06      0.00     96.66
Average:          1      3.04      0.00      1.09      0.00      0.00     95.87

6) To Print particular date CPU report usage.

To print the particular date CPU report usage, use (-f) option to print it, Here i’m going to print yesterday (11-Dec-2013) CPU report.

# sar -f /var/log/sa/sa11
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   11/12/13        _x86_64_        (24 CPU)

00:00:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
00:10:01        all      0.32      0.00      0.24      0.00      0.00     99.44
00:20:01        all      0.29      0.00      0.23      0.00      0.00     99.48
00:30:01        all      0.31      0.00      0.25      0.00      0.00     99.44
00:40:01        all      0.39      0.00      0.30      0.00      0.00     99.31
00:50:01        all      0.31      0.00      0.24      0.00      0.00     99.44
.
.
05:50:01        all      0.97      0.00      0.81      0.00      0.00     98.22
06:00:01        all      1.15      0.00      0.80      0.00      0.00     98.06
06:10:01        all      1.22      0.00      0.84      0.00      0.00     97.94
06:20:01        all      0.73      0.00      0.55      0.00      0.00     98.72
06:30:01        all      0.61      0.00      0.47      0.00      0.00     98.92
06:40:01        all      0.22      0.00      0.19      0.00      0.00     99.59
06:50:01        all      0.20      0.00      0.20      0.00      0.00     99.60
07:00:01        all      0.18      0.00      0.18      0.00      0.00     99.64

7) To Print the RAM report usage.

The RAM values (-r) for the current day report printed here

# sar -r
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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
00:30:01     19839572  13030172     39.64    348352  11087968   1472560      3.98
00:40:01     19857340  13012404     39.59    348376  11072396   1472356      3.98
00:50:01     19872848  12996896     39.54    348408  11052740   1474876      3.99
01:00:01     19910460  12959284     39.43    348424  11013716   1475892      3.99
01:10:01     19940732  12929012     39.33    348428  10981984   1480416      4.00
.
.
14:20:01     24237008   8632736     26.26    172572   6745388   1733772      4.69
14:30:01     24505260   8364484     25.45    171280   6212116   3269660      8.85
14:40:01     25053000   7816744     23.78    171880   6076184   1532240      4.15
14:50:01     25087024   7782720     23.68    173152   6074376   1501108      4.06
Average:     21599072  11270672     34.29    278171   9372219   1562020      4.23

Details of SAR command output.

kbmemfree: Free memory details.
Kbmemused: Used memory details.
%memused: percentage of memory used.
kbbuffers: buffer memory used by the kernel.
kbcached: cached memory used by the kernel.

8) To Print the SWAP SPACE report usage.

The SWAP SPACE values (-S) for the current day report printed here

# sar -S
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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
00:30:01      4095992         0      0.00         0      0.00
00:40:01      4095992         0      0.00         0      0.00
00:50:01      4095992         0      0.00         0      0.00
01:00:01      4095992         0      0.00         0      0.00
01:10:01      4095992         0      0.00         0      0.00
.
.
14:20:01      4095992         0      0.00         0      0.00
14:30:01      4095992         0      0.00         0      0.00
14:40:01      4095992         0      0.00         0      0.00
14:50:01      4095992         0      0.00         0      0.00
15:00:01      4095992         0      0.00         0      0.00
Average:      4095992         0      0.00         0      0.00

9) To identify number of memory pages freed, used, and cached per second.

The (-R) option To identify number of memory pages freed, used, and cached per second by the server.

# sar -R
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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:30:01        10.37      0.01     -9.91
00:40:01         7.42      0.01     -6.50
00:50:01         6.47      0.01     -8.20
01:00:01        15.68      0.01    -16.27
.
.
16:30:01        -7.87      0.14     -1.49
Average:        22.42     -0.71    -21.61

10) To Print paging statistics usage.

The (-B) option Print paging statistics usage. Say for example Number of KB paged IN & OUT from disk per second.

# sar -B
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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
00:30:01         0.00     30.28    189.71      0.00    228.46      0.00     14.25     10.25     71.91
00:40:01         0.00     29.98    185.66      0.00    222.56      0.00      9.19      6.84     74.42
00:50:01         0.01     32.97    232.16      0.00    260.36      0.00     11.21      8.54     76.19
01:00:01         0.00     36.23    207.23      0.00    252.64      0.00     21.24     15.37     72.36
.
.
16:20:01         0.03     52.00    590.14      0.00    538.20      0.00      0.00      0.00      0.00
16:30:01         0.07     48.84    373.43      0.00    354.34      0.00      2.56      1.71     66.67
Average:         0.73     45.64    610.42      0.01    574.33      0.00     36.24     22.88     63.13

11) To Print page swap statistics.

The (-W) option print the page swap statistics. Say for example Page swap IN & OUT per second.

# sar -W
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

00:00:01     pswpin/s pswpout/s
00:10:01         0.00      0.00
00:20:01         0.00      0.00
00:30:01         0.00      0.00
00:40:01         0.00      0.00
00:50:01         0.00      0.00
01:00:01         0.00      0.00
.
.
16:20:01         0.00      0.00
16:30:01         0.00      0.00
Average:         0.00      0.00

12) To Print queue and overall load average usage.

The (-q) option print the queue and overall load average usage for the current date. This will print past 1 minute, 5 minutes, and 15 minutes report.

# sar -q
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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
00:40:01            0       455      0.02      0.04      0.00
00:50:01            0       455      0.01      0.03      0.00
01:00:01            0       455      0.00      0.01      0.00
01:10:01            1       458      0.18      0.07      0.01
.
.
14:30:01            0       484      0.03      0.05      0.07
14:40:01            0       461      0.05      0.05      0.07
14:50:01            2       476      0.39      0.25      0.14
15:00:01            1       463      0.07      0.18      0.16
15:10:01            1       474      0.15      0.12      0.13
Average:            0       459      0.11      0.09      0.05

13) To Print Overall I/O Activities.

The (-b) option print the Overall I/O Activities usage for the current date.

# sar -b
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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:30:01         3.00      0.00      3.00      0.00     60.57
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
01:00:01         3.33      0.00      3.33      0.00     72.46
01:10:01         3.26      0.01      3.25      0.33     65.16
.
.
14:30:01         4.55      0.21      4.33      4.82     97.87
14:40:01         4.70      0.19      4.51      5.32     98.62
14:50:01         6.34      0.09      6.25      0.91    150.56
15:00:01         7.60      0.16      7.44      3.26    177.74
15:10:01         7.33      0.16      7.17      2.23    169.29
Average:         4.15      0.05      4.10      1.53     88.86

14) To Print Individual Block Device I/O Activities.

The (-d) option print the Individual Block Device I/O Activities usage for the current date.

# sar -d
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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
00:30:01       dev8-0      3.00      0.00     60.57     20.18      0.00      0.23      0.09      0.03
00:40:01       dev8-0      3.05      0.00     59.97     19.68      0.00      0.18      0.09      0.03
00:50:01       dev8-0      3.29      0.01     65.94     20.07      0.00      0.27      0.11      0.04
01:00:01       dev8-0      3.33      0.00     72.46     21.79      0.00      0.26      0.10      0.03
.
.
15:00:01       dev8-0      7.60      3.26    177.74     23.82      0.01      1.35      0.30      0.23
15:10:01       dev8-0      7.33      2.23    169.29     23.40      0.01      1.45      0.31      0.23
15:20:01       dev8-0      6.55      1.39    150.67     23.20      0.01      0.91      0.28      0.19
Average:       dev8-0      4.18      1.53     89.54     21.80      0.00      0.53      0.19      0.08

15) To Print context switch .

The (-w) option print the context switch usage for the current date.

# sar -w
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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:50:01         1.13    568.93
01:00:01         1.11    565.95
01:10:01         1.13    584.98
.
.
14:40:01         1.87    789.77
14:50:01         2.91   1131.62
15:00:01         3.16   1227.48
15:10:01         3.06   1193.49
15:20:01         3.34   1313.38
15:30:01         3.64   1455.07
Average:         1.75    796.07

16) To Print network statistics.

The (-n) option print the network statistics usage for the current date.

Syntax :sar -n KEYWORD

List of KEYWORD’s available.

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
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 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

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
00:20:01           lo      0.02      0.02      0.00      0.00      0.00      0.00      0.00
00:20:01         eth0     24.19     31.55      5.58     31.35      0.00      0.00      0.00
00:20:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:30:01           lo      0.02      0.02      0.00      0.00      0.00      0.00      0.00
00:30:01         eth0     21.82     27.05      4.72     26.45      0.00      0.00      0.00
00:30:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
.
.
15:20:01           lo      1.54      1.54      0.14      0.14      0.00      0.00      0.00
15:20:01         eth0     52.22     74.02     14.02     75.49      0.00      0.00      0.00
15:20:01         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
15:30:01           lo      0.91      0.91      0.09      0.09      0.00      0.00      0.00
15:30:01         eth0     54.22     76.47     15.41     77.35      0.00      0.00      0.00
15:30: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     74.39    141.13     10.41    181.18      0.00      0.00      0.00
Average:         eth1      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Details of SAR command output.

IFACE: stands for the nic card interface name
rxpck/s: How many packets received per second
txpck/s: transmitted packets per second
rxcmp/s: compressed packets received
txcmp/s: compressed packets transmitted
rxmcst/s: packets multicasted per second.

17) To Print the Values at particular time.

The (-s) option print the Values at particular time. We can mention the start time but we can’t mentioned the end time, there is no option for that. If you needed you can use the tail or more option to do it.

# sar -f /var/log/sa/sa12 -s 15:00:00
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _x86_64_        (24 CPU)

15:00:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
15:10:01        all      1.28      0.00      0.92      0.01      0.00     97.79
15:20:01        all      1.51      0.00      1.00      0.00      0.00     97.49
15:30:01        all      1.62      0.00      1.14      0.00      0.00     97.24
15:40:01        all      0.92      0.00      0.73      0.00      0.00     98.36
15:50:02        all      0.95      0.00      0.74      0.00      0.00     98.30
16:00:01        all      1.27      0.00      0.93      0.00      0.00     97.79
Average:        all      1.26      0.00      0.91      0.00      0.00     97.83

18) To Print All Values.

The (-A) option print the All Values (CPU, RAM, swap, network, i/o, etc.) for the current date.

# sar -A
Linux 2.6.32-358.6.1.el6.x86_64 (server.2daygeek.com)   12/12/13        _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

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...