Friday, August 5, 2011

sar

Sar
=================
1,root@testserver [~]# sar -u
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 CPU %user %nice %system %iowait %steal %idle
00:10:01 all 0.04 0.00 0.02 0.00 0.00 99.94
00:20:01 all 0.04 0.00 0.01 0.00 0.00 99.95
00:30:01 all 0.03 0.00 0.01 0.00 0.00 99.95

%user: Percentage of CPU utilization that occurred while executing at the user level (application).
%nice: Percentage of CPU utilization that occurred while executing at the user level with nice priority.
%system: Percentage of CPU utilization that occurred while executing at the system level (kernel).
%iowait: Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
%idle: Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
==============

2,root@testserver [~]# sar -c
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 proc/s
00:10:01 67.49
00:20:01 23.24
00:30:01 14.26
00:40:01 14.31


To view process creation statistics, enter:

==============

3,root@testserver [~]# sar -b
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 tps rtps wtps bread/s bwrtn/s
00:10:01 0.00 0.00 0.00 0.00 0.00
00:20:01 0.00 0.00 0.00 0.00 0.00

tps
Total number of transfers per second that were issued to physical devices. A transfer is an I/O request to a physical device. Multiple logical requests can be combined into a single I/O request to the device. A transfer is of indeterminate size.

rtps
Total number of read requests per second issued to physical devices.

wtps
Total number of write requests per second issued to physical devices.

bread/s
Total amount of data read from the devices in blocks per second. Blocks are equivalent to sectors and therefore have a size of 512 bytes.

bwrtn/s
Total amount of data written to devices in blocks per second.
==============
sar -r

The -r argument shows free memory and swap space over time.
00:00:01 kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad
00:10:01 7729888 434288 5.32 0 0 0 0 0.00 0
00:20:01 7731636 432540 5.30 0 0 0 0 0.00 0
00:30:01 7728988 435188 5.33 0 0 0 0 0.00 0
00:40:01 7732808 431368 5.28 0 0 0 0 0.00 0
00:50:01 7734200 429976 5.27 0 0 0 0 0.00 0
Average: 7731504 432672 5.30 0 0 0 0 0.00 0
=====================



cd /var/log/sa/
-rw-r--r-- 1 root root 279024 Aug 1 23:50 sa01
-rw-r--r-- 1 root root 279024 Aug 2 23:50 sa02
-rw-r--r-- 1 root root 17664 Aug 3 01:20 sa03

sar -q -f sa01 | less

====================
root@testserver [~]# sar -P ALL
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 CPU %user %nice %system %iowait %steal %idle
00:10:01 all 0.04 0.00 0.02 0.00 0.00 99.94
00:10:01 0 0.02 0.00 0.01 0.00 0.00 99.97
00:10:01 1 0.01 0.00 0.01 0.00 0.00 99.99
00:10:01 2 0.05 0.00 0.02 0.00 0.00 99.94
00:10:01 3 0.04 0.00 0.01 0.00 0.00 99.95
00:10:01 4 0.03 0.00 0.02 0.00 0.00 99.95
00:10:01 5 0.07 0.04 0.02 0.02 0.00 99.85
00:10:01 6 0.08 0.00 0.02 0.01 0.00 99.89
00:10:01 7 0.02 0.00 0.01 0.00 0.00 99.96
====================
root@testserver [~]# sar -R
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 frmpg/s bufpg/s campg/s
00:10:01 1.46 0.00 0.00
00:20:01 0.73 0.00 0.00
00:30:01 -1.10 0.00 0.00

-R
Report memory statistics. The following values are displayed:

frmpg/s

Number of memory pages freed by the system per second. A negative value represents a number of pages allocated by the system. Note that a page has a size of 4 kB or 8 kB according to the machine architecture.

bufpg/s

Number of additional memory pages used as buffers by the system per second. A negative value means fewer pages used as buffers by the system.

campg/s

Number of additional memory pages cached by the system per second. A negative value means fewer pages in the cache.
====================
root@testserver [/var/log/sa]# sar -q
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15
00:10:01 1 88 0.00 0.00 0.00

This reports the run queue size and load average of last 1 minute, 5 minutes, and 15 minutes. “1 3″ reports for every 1 seconds a total of 3 times.
The “blocked” column displays the number of tasks that are currently blocked and waiting for I/O operation to complete.
====================
sar -w

00:00:01 cswch/s
00:10:01 1958.80

his reports the total number of context switches per second.

===========
root@testserver [/var/log/sa]# sar -v
Linux 2.6.18-92.1.18.el5.028stab060.8 (testserver.com) 08/03/11

00:00:01 dentunusd file-sz inode-sz super-sz %super-sz dquot-sz %dquot-sz rtsig-sz %rtsig-sz
00:10:01 528134 510 196314 0 0.00 0 0.00 0 0.00
00:20:01 531924 1 197341 0 0.00 0 0.00 0 0.00

================

sar -n DEV Report network statistics.

IFACE
Name of the network interface for which statistics are reported.

rxpck/s
Total number of packets received per second.

txpck/s
Total number of packets transmitted per second.

rxbyt/s
Total number of bytes received per second.

txbyt/s
Total number of bytes transmitted per second.

rxcmp/s
Number of compressed packets received per second (for cslip etc.).

txcmp/s
Number of compressed packets transmitted per second.

rxmcst/s
Number of multicast packets received per second.
========================



II: SAR: It dispalys the cpu utility

=========================
From the sar command we will get the following informations:

1. CPU utilization
2. Memory paging and its utilization
3. Network I/O, and transfer statistics
4. Process creation activity
5. All block devices activity
6. Interrupts/sec etc.
=========================

contents of sar command /usr/sbin/sar
symbolic link to the sar command. /bin/sar
log file /var/log/sa
==========================

No comments:

Post a Comment