HomePage » GeneralUnix » UnixSar


Sar

sar is a useful command from the sysstat package which captures your system usage. The following example dumps system usage to a file every 10 seconds for 100 times -

$ sar -u -o sar.out 10 100


To read the statistics contained in that file
$ sar -f sar.out
Linux 2.6.22.6 (x.x.corp)         10/11/2007

03:11:47 PM       CPU     %user     %nice   %system   %iowait    %steal     %idle
03:11:49 PM       all      4.00      0.00      0.50      0.00      0.00     95.50
03:12:08 PM       all      8.00      0.00      2.50     30.50      0.00     59.00
Average:          all      5.28      0.00      1.40      4.11      0.00     89.21


Sar and cron
Redhat by default creates these cron entries to capture system usage with sar. It's placed under /etc/crond.d

# run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib/sa/sa2 -A

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki