Linux Scroll

Just another WordPress.com site

sar Command

sar – Collect, report, or save system activity information.

CPU statistics 5 times (with 1 second interval):

$ sar 1 5
Linux 2.6.35-28-generic (Hostname) Date _x86_64_ (1 CPU)

09:09:32 PM CPU %user %nice %system %iowait %steal %idle
09:09:33 PM all 4.00 0.00 1.00 0.00 0.00 95.00
09:09:34 PM all 4.00 0.00 4.00 0.00 0.00 92.00
09:09:35 PM all 5.00 0.00 2.00 0.00 0.00 93.00
09:09:36 PM all 4.00 0.00 2.00 0.00 0.00 94.00
09:09:37 PM all 5.00 0.00 2.00 0.00 0.00 93.00
Average: all 4.40 0.00 2.20 0.00 0.00 93.40

sar Version:

$ sar -V
sysstat version 9.0.6.1
(C) Sebastien Godard (sysstat orange.fr)

CPU usage of individual Core:

$ sar -P ALL 1 1
Linux 2.6.35-28-generic (Hostname) Date _x86_64_ (1 CPU)

11:29:21 PM CPU %user %nice %system %iowait %steal %idle
11:29:22 PM all 40.00 0.00 8.00 0.00 0.00 52.00
11:29:22 PM 0 40.00 0.00 8.00 0.00 0.00 52.00
11:29:22 PM 1 40.00 0.00 8.00 0.00 0.00 52.00

Average: CPU %user %nice %system %iowait %steal %idle
Average: all 40.00 0.00 8.00 0.00 0.00 52.00
Average: 0 40.00 0.00 8.00 0.00 0.00 52.00
Average: 1 40.00 0.00 8.00 0.00 0.00 52.00

CPU usage of seeond Core only:

$ sar -P 1 1 1
Linux 2.6.35-28-generic (Hostname) Date _x86_64_ (1 CPU)

11:29:21 PM CPU %user %nice %system %iowait %steal %idle
11:29:22 PM 1 40.00 0.00 8.00 0.00 0.00 52.00

Average: CPU %user %nice %system %iowait %steal %idle
Average: 1 40.00 0.00 8.00 0.00 0.00 52.00

Memory usage:

$ sar -r 1 3
Linux 2.6.35-28-generic (Hostname) Date _x86_64_ (1 CPU)

11:36:01 PM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit
11:36:02 PM 2752924 1045940 27.53 44012 291864 1615028 13.85
11:36:03 PM 2752924 1045940 27.53 44012 291864 1615028 13.85
11:36:04 PM 2752924 1045940 27.53 44012 291864 1615028 13.85
Average: 2752924 1045940 27.53 44012 291864 1615028 13.85

Swap usage:

$ sar -S 1 3
Linux 2.6.35-28-generic (Hostname) Date _x86_64_ (1 CPU)

12:48:50 PM kbswpfree kbswpused %swpused kbswpcad %swpcad
12:48:51 PM 7863780 0 0.00 0 0.00
12:48:52 PM 7863780 0 0.00 0 0.00
12:48:53 PM 7863780 0 0.00 0 0.00
Average: 7863780 0 0.00 0 0.00

Swap statistic:

$ sar -W 1 3
Linux 2.6.35-28-generic (Hostname) Date _x86_64_ (1 CPU)

12:50:36 PM pswpin/s pswpout/s
12:50:37 PM 0.00 0.00
12:50:38 PM 0.00 0.00
12:50:39 PM 0.00 0.00
Average: 0.00 0.00

Overall I/O activities:

$ sar -b 1 3
Linux 2.6.35-28-generic (1010) 07/29/2011 _x86_64_ (1 CPU)

01:02:27 PM tps rtps wtps bread/s bwrtn/s
01:02:28 PM 0.00 0.00 0.00 0.00 0.00
01:02:29 PM 0.00 0.00 0.00 0.00 0.00
01:02:30 PM 0.00 0.00 0.00 0.00 0.00
Average: 0.00 0.00 0.00 0.00 0.00

* tps – Transactions per second (read and write)
* rtps – Read transactions per second
* wtps – Write transactions per second
* bread/s – Bytes read per second
* bwrtn/s – Bytes written per second

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: