Linux System Activity Report SAR Graphs

One of the extremely useful tools to get an overview of what system is doing is a SAR reports,

We can see SAR stats by simply issuing the command:

# sar

Linux 3.0.74-0.6.8-default (hostname)      10/09/13        _x86_64_

00:00:01 CPU %user %nice %system %iowait %steal %idle
00:10:01 all  0.25  0.00  0.18    0.02     0.00 99.56

In most cases it is run as daemon in system and create the stats every 10 minutes,

We can also see current system statistics by issuing following command:

# sar 2 5

which create report every 2 seconds for 5 times,

Cron jobs can be find in sysstat file under cron.d directory:

# 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

The first cron sa1 gather systems stats every 10min by default to non human readable raw sa** files. (** represnt a day of the month in sa and sar files)

Then sa2 process sa** files once a day at 23:53 evening.

You can process the sa** raw data and generate reports under sar** manually by issuing the sa2 command:

/usr/lib64/sa/sa2 -A

You can create graphs from SAR reports to have a better view of system performance, to achieve this we can use a third party tool KSar which is avalible from it's site:

In order to make graph we need sar files located in /var/log/sa directory:

# ls /var/log/sa

sa11  sa12  sa13  sa14  sa15  sa16  sa17  sa18  sar11  sar12  sar13  sar14  sar15  sar16  sar17  sar18

You can transfer sar files over to your system via WinSCP. Java Runtime JRE needs to be installed in your system as well.

Then open a command prompt and change directory to Ksar folder and issue the following command:

> cd C:\KSAR

> java -jar kSar.jar -input "C:\KSAR\sar10" -outputPDF "C:\Ksar_graphs\SAR_report.pdf"

for -input option you need to give the path of your sar log where you downloaded it, and -outputPDF is a path where graph will be created in PDF format.

And there you go. You have the SAR reports nicely graphed for you.


Popular posts from this blog

Linux and AIX user non expiry and force password change at first login

Rebuild your new Yum repository after changing the packages

Running Docker Wildfly/JBoss Application Server in Debug mode via Eclipse