Sunday, June 29, 2014

Little background about SAR

By default Linux and Unix machines stores the SAR (System Activity Report) output for 9 days. And it will be stored inside the /var/log/sa/ directory.

image

[thiru@localhost~]$ ls -ltr /var/log/sa/sa*|grep -v sar
-rw-r--r-- 1 root root 338928 Jan 13 23:50 /var/log/sa/sa13
-rw-r--r-- 1 root root 338928 Jan 14 23:50 /var/log/sa/sa14
-rw-r--r-- 1 root root 338928 Jan 15 23:50 /var/log/sa/sa15
-rw-r--r-- 1 root root 338928 Jan 16 23:50 /var/log/sa/sa16
-rw-r--r-- 1 root root 338928 Jan 17 23:50 /var/log/sa/sa17
-rw-r--r-- 1 root root 338928 Jan 18 23:50 /var/log/sa/sa18
-rw-r--r-- 1 root root 338928 Jan 19 23:50 /var/log/sa/sa19
-rw-r--r-- 1 root root 338928 Jan 20 23:50 /var/log/sa/sa20
-rw-r--r-- 1 root root  82560 Jan 21 05:40 /var/log/sa/sa21

We can extract the memory utilization, CPU, Swap, IO from the stored SAR report by providing the specified SAR report file.

Example:

I - RAM Memory utilization

[thiru@localhost~]$ sar -r -f /var/log/sa/sa20

10:40:01 PM kbmemfree kbmemused  %memused kbbuffers  kbcached kbswpfree kbswpused  %swpused  kbswpcad
10:50:01 PM  28089004   6510764     18.82    468820    386136  32505732       108      0.00         0
11:00:01 PM  28087392   6512376     18.82    470460    386144  32505732       108      0.00         0
11:10:01 PM  28081460   6518308     18.84    472020    390504  32505732       108      0.00         0
11:20:01 PM  28079972   6519796     18.84    473672    390504  32505732       108      0.00         0
11:30:02 PM  28078236   6521532     18.85    475384    390512  32505732       108      0.00         0
11:40:01 PM  28076872   6522896     18.85    477040    390508  32505732       108      0.00         0
11:50:01 PM  28073836   6525932     18.86    478784    390560  32505732       108      0.00         0
Average:     13386344  21213424     61.31    227578  15170261  32505732       108      0.00 

II - CPU Utilization

“[thiru@localhost~]$ sar -u -f /var/log/sa/sa20

05:40:01 AM       CPU     %user     %nice   %system   %iowait    %steal     %idle
05:50:02 AM       all     80.62      0.00      1.67      0.12      0.00     17.59
06:00:02 AM       all     81.22      0.00      1.70      0.09      0.00     17.00
06:10:01 AM       all     81.39      0.00      1.69      0.10      0.00     16.82
06:20:02 AM       all     81.59      0.00      1.72      0.12      0.00     16.58
06:30:01 AM       all     80.31      0.00      1.71      0.09      0.00     17.90
06:40:01 AM       all     80.88      0.00      1.82      0.11      0.00     17.19
06:50:01 AM       all     81.05      0.00      1.87      0.05      0.00     17.04
07:00:01 AM       all     80.31      0.00      2.07      0.03      0.00     17.58
07:10:01 AM       all     80.80      0.00      2.30      0.11      0.00     16.79
07:20:01 AM       all     79.90      0.00      2.27      0.08      0.00     17.74
07:30:01 AM       all     79.97      0.00      2.33      0.06      0.00     17.64
07:40:02 AM       all     80.84      0.00      2.59      0.06      0.00     16.52
07:50:01 AM       all     79.75      0.00      2.42      0.05      0.00     17.79
08:00:01 AM       all     81.13      0.00      2.21      0.10      0.00     16.56
08:10:02 AM       all     81.71      0.00      1.74      0.08      0.00     16.46

1 comment:

  1. Use the below syntax to append it into a file and analyze it.
    LC_TIME=POSIX sar -A -f /var/log/sa/sar15 >> Sar.log
    (append the data into same file if you need to extract data for two or more days)

    ReplyDelete