Sunday, 11 March 2012

server monitoring useing iostat

iostat / vmstat / mpstat are some tools to monitor server performance. 

 * iostat reports CPU, disk I/O, and NFS statistics.

 * vmstat reports virtual memory statistics.

 *  mpstat reports processors statictics.

iostat

Iostat without any argument displays information about the CPU usage, and I/O statistics about all the partitions on the system are showing:

 # iostat

Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03/11/2012

avg-cpu:  %user   %nice  %system %iowait  %steal   %idle
                  1.98     17.92    8.59       0.33       0.00       71.17

Device:            tps      Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda                13.89        33.54         365.15       14323873   155932064
sda1              13.84        32.34         363.73       13808779   155327336
sda2               0.05         1.20           1.42           514566       604728



Display only cpu statistics

# iostat -c

Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03/11/2012

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
                 1.98     17.92    8.59       0.33         0.00     71.17

Display only disk I/O statistics

# iostat -d

Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03/11/2012

Device:         tps      Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              13.89        33.53         365.04     14323921  155949184
sda1             13.84        32.32        363.62     13808827  155344456
sda2              0.05         1.20          1.42          514566      604728

Display only network statistics

-n, displays only the device and NFS statistics.

# iostat -n

Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03/11/2012

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
                  1.98    17.93    8.59        0.33        0.00      71.17

Device:            tps     Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda                 13.89       33.52        365.00     14323937    155957552
sda1               13.84       32.32        363.58     13808843    155352824
sda2                0.05        1.20          1.42         514566        604728

Device:    rBlk_nor/s   wBlk_nor/s   rBlk_dir/s   wBlk_dir/s   rBlk_svr/s 
                                                                               wBlk_svr/s    rops/s    wops/s

192.168.1.4:/home/pac  90.67        0.00         0.00         0.00         5.33         0.00
192.168.1.4:/bkp            8.74         0.00         0.00         0.00         8.74         0.00
192.168.1.8:/media          0.02         0.00         0.00         0.00         0.01         0.00

Display I/O data in MB/second

By default iostat, displays the device I/O statistics in Blocks. To change it to MB, use -m as shown  

# iostat -m

Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03/11/2012

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
                  1.98     17.93    8.59     0.33          0.00     71.16

Device:           tps    MB_read/s   MB_wrtn/s    MB_read    MB_wrtn
sda               13.88     0.02            0.18              6994           76165
sda1             13.83     0.02            0.18              6742           75869
sda2              0.05      0.00            0.00               251             295

Display I/O statistics only for a device

# iostat -p sda

Display timestamp information

# iostat -t

Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03/11/2012

Time: 05:51:24 PM
avg-cpu:  %user   %nice  %system %iowait  %steal   %idle
               1.98     17.93    8.59      0.33        0.00     71.16

Device:         tps      Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              13.88        33.49        364.77        14324049   156006600
sda1             13.83        32.29        363.35        13808955   155401872
sda2              0.05         1.20          1.41           514566      604728

Execute Every x seconds - y number of times

# iostat 2
# iostat 2 3 --- execute every 2 seconds for 3 times

Display LVM statistic

# iostat -N

No comments:

Post a Comment