Learn System Activity Report sar command with real-world scenario examples. Understand how to do disk, network reporting using this command.
In the last two parts of the sar command, we have seen time formats to be used with command, its data files, CPU & Memory reporting. In this last part, we will be seeing disk, network reporting using sar command.
Read last two parts of this tutorial here :
Disk IO reporting
sar
provides disk (block devices) report with -d
option. Normally, it shows below parameters values (highlighted values are more commonly observed for performance monitoring) :
DEV
: Block device name. It follows the dev m-n format. M is major and n is a minor number of the block devices.tps
: Transfers per secondrd_sec/s
: Sector reads per second (sector is 512 byte)wr_sec/s
: Sector writes per secondavgrq-sz
: average size (in sectors) of the requests that were issued to the deviceavgqu-sz
: average queue length of the requests that were issued to the deviceawait
: The average time (in milliseconds) for I/O requestssvctm
: The average service time (in milliseconds) for I/O requests%util
: Percentage of CPU time during which I/O requests were issued to the device
# sar -d 2 3
Linux 2.6.39-200.24.1.el6uek.x86_64 (testsrv2) 12/21/2016 _x86_64_ (4 CPU)
01:20:19 AM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
01:20:21 AM dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:20:21 AM dev8-64 3.00 2.00 1.00 1.00 0.00 0.50 0.50 0.15
01:20:21 AM dev8-32 3.00 2.00 1.00 1.00 0.00 0.50 0.33 0.10
01:20:21 AM dev252-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:20:21 AM dev252-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:20:21 AM dev252-2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
In the above output, device names are not so user friendly. So to identify devices easily, -p option is available. This option prints pretty device names in the DEV column and it should always be used with -d option.
# sar -d -p 2 3
Linux 2.6.39-200.24.1.el6uek.x86_64 (testsrv2) 12/21/2016 _x86_64_ (4 CPU)
01:20:38 AM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
01:20:40 AM sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:20:40 AM sdb 4.98 0.00 91.54 18.40 0.00 0.80 0.20 0.10
01:20:40 AM sdc 2.99 1.99 1.00 1.00 0.00 0.67 0.67 0.20
01:20:40 AM dm-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:20:40 AM dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:20:40 AM dm-2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Now see above output where device names are easily identifiable. sda
means disk /dev/sda
and so on.
Network utilization reporting
Option -n
gives all network stats. There are a total of 18 different keywords (like NFS, IP, DEV, TCP, etc.) which can be used with -n
option to get related parameters. Each keyword has almost 8-10 parameters to display. So in the call, if you are using ALL keyword, then the output will be a huge list of parameters which is difficult to understand.
To keep it short here we will see only one example of keyword DEV i.e. device. This will show the device i.e. network card’s parameter values. Most of the time NIC performance is checked hence we are using this keyword example.
# sar -n DEV 2 1
Linux 2.6.39-200.24.1.el6uek.x86_64 (textsrv2) 12/21/2016 _x86_64_ (4 CPU)
01:35:22 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
01:35:24 AM lo 6.00 6.00 0.29 0.29 0.00 0.00 0.00
01:35:24 AM eth0 15.50 0.50 0.91 0.04 0.00 0.00 0.00
01:35:24 AM eth1 6.50 4.50 0.97 0.77 0.00 0.00 0.00
01:35:24 AM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
Average: lo 6.00 6.00 0.29 0.29 0.00 0.00 0.00
Average: eth0 15.50 0.50 0.91 0.04 0.00 0.00 0.00
Average: eth1 6.50 4.50 0.97 0.77 0.00 0.00 0.00
Average: eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
In the above example, I used the DEV keyword along with -n
option and took only one iteration in output. Parameters displayed for device keyword are :
IFACE
: Its interface name. You can easily see eth0, eth1, loopback (lo) interfaces here.rxpck/s
: Packets received per secondstxpck/s
: packets transmitted per secondrxkB/s
: kilobytes received per secondtxkB/s
: kilobytes transmitted per secondrxcmp/s
: compressed packets received per secondtxcmp/s
: compressed packets transmitted per secondrxmcst/s
: Number of multicast packets received per second
This concludes sar
command tutorial’s part III about the disk, network reporting. This is a three-part tutorial with example outputs included. Put your queries, suggestions, feedback in the comments below. You can also reach us using our Contact form.
Share Your Comments & Feedback: