Load & Memory monitoring using SAR

Installation

Install Sysstat Package

sudo apt-get install sysstat

(or)

yum install sysstat

(or)

rpm -ivh sysstat-10.0.0-1.i586.rpm

sysstat – daemon

Using sar we can monitor performance of server(load, memory etc…) in real time.

sar -q

Report load average. (fetch data from /var/log/sa(sysstat)/sa*, where sa* represent the date like sa10,sa11,sa12etc.).

Examples,

sar -q (List current day's load averages starting from 12:00:00, with 10 minute interval).
sar -q 1 5 (List load averages 5 times from when we enter this with an interval of 1 sec).
sar -q -f /var/log/sa/sa23 (Fetch data from /var/log/sa/sa23).

sar -r

Report memory details.

Examples,

sar -r (List current days memory usage from 12:00:00)
sar -r 1 5 (List memory usage 5 times from when we enter this with an interval of 1 sec).
sar -r -f /var/log/sa/sa23 (Fetch data from /var/log/sa/sa23).

Examples,

$ sar -q
Linux 3.8.0-19-generic (ubuntu) 	Tuesday 03 September 2013 	_i686_	(2 CPU)
07:09:45  IST       LINUX RESTART
07:15:01  IST   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
07:25:01  IST         0       451      0.43      0.41      0.35         0
07:35:01  IST         0       469      0.51      0.45      0.41         1
07:45:01  IST         0       457      0.37      0.40      0.41         0
07:55:01  IST         0       460      0.22      0.26      0.34         0
08:05:01  IST         0       464      0.39      0.44      0.39         0
08:15:01  IST         1       464      0.29      0.35      0.36         0
08:25:01  IST         0       462      0.10      0.22      0.29         0
$ sar -q 1 5
Linux 3.8.0-19-generic (ubuntu) 	Tuesday 03 September 2013 	_i686_	(2 CPU)
08:11:31  IST   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
08:11:32  IST         0       837      0.37      0.28      0.26         0
08:11:33  IST         0       837      0.37      0.28      0.26         0
08:11:34  IST         1       836      0.37      0.28      0.26         0
08:11:35  IST         0       837      0.37      0.28      0.26         0
08:11:36  IST         0       837      0.34      0.27      0.26         0
Average:            0       837      0.36      0.28      0.26         0
$ sar -q -f /var/log/sysstat/sa31
Linux 3.8.0-19-generic (ubuntu) 	Saturday 31 August 2013 	_i686_	(2 CPU)
06:59:36  IST       LINUX RESTART
07:05:01  IST   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
07:15:01  IST         0       441      0.08      0.33      0.37         0
07:25:01  IST         0       444      0.55      0.51      0.43         0
07:35:01  IST         0       440      0.34      0.43      0.41         0
07:45:01  IST         1       450      1.18      0.68      0.50         0
07:55:01  IST         1       451      1.18      1.39      0.97         1 
$ sar -r
Linux 3.8.0-19-generic (ubuntu) 	Tuesday 03 September 2013 	_i686_	(2 CPU)
07:09:45  IST       LINUX RESTART
07:15:01  IST kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact
07:25:01  IST    474968   1328668     73.67     93124    594692   3337476     91.80    817932    369976
07:35:01  IST    226048   1577588     87.47    105176    710308   3616268     99.47    917484    467908
07:45:01  IST    209272   1594364     88.40    113476    706056   3566672     98.10    767164    621764
07:55:01  IST    154132   1649504     91.45    112828    657796   3657940    100.62    726264    717876
08:05:01  IST    170096   1633540     90.57    114240    625032   3770396    103.71    678192    729460
08:15:01  IST    156800   1646836     91.31    115424    629584   3755640    103.30    771496    650268
08:25:01  IST    222208   1581428     87.68    116728    633084   3763212    103.51    703540    652292 
$ sar -r 1 5
Linux 3.8.0-19-generic (ubuntu) 	Tuesday 03 September 2013 	_i686_	(2 CPU)
07:41:24  IST kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact
07:41:25  IST    121692   1681944     93.25      2820    217776   8251696    226.97    528212    528260
07:41:26  IST    121692   1681944     93.25      2820    217776   8251696    226.97    528224    528260
07:41:27  IST    121692   1681944     93.25      2820    217776   8251828    226.97    528232    528260
07:41:28  IST    121320   1682316     93.27      2820    217776   8251828    226.97    528428    528260
07:41:29  IST    121196   1682440     93.28      2828    217772   8251828    226.97    528652    528260
Average:       121518   1682118     93.26      2822    217775   8251775    226.97    528350    528260
$ sar -r -f /var/log/sysstat/sa31
Linux 3.8.0-19-generic (ubuntu) 	Saturday 31 August 2013 	_i686_	(2 CPU)
06:59:36  IST       LINUX RESTART
07:05:01  IST kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact
07:15:01  IST    275668   1527968     84.72     66944    710104   3369400     92.68    857776    470164
07:25:01  IST    148320   1655316     91.78     99344    679552   3537784     97.31    710692    727292
07:35:01  IST    166196   1637440     90.79    100840    685880   3463628     95.27    708924    711872
07:45:01  IST    150544   1653092     91.65    102620    632148   3623020     99.65    703284    733340
07:55:01  IST    175800   1627836     90.25     89196    561716   3711724    102.09    709260    702136

-r and -q is the commonly used SAR switches, Please refer to other switches too (-u, -v, -P, -d, -betc…)

Secure and Reliable Node.js Hosting for Your Critical Applications

Trust Veeble for secure Node.js hosting. Free SSL, DDoS protection, and global servers. Your applications, protected and fast.

Related articles

Scroll to Top