{"id":2365,"date":"2013-07-16T12:37:56","date_gmt":"2013-07-16T04:37:56","guid":{"rendered":"http:\/\/rmohan.com\/?p=2365"},"modified":"2013-07-16T12:38:13","modified_gmt":"2013-07-16T04:38:13","slug":"iostat-vmstat-mpstat","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2365","title":{"rendered":"iostat \/ vmstat \/ mpstat"},"content":{"rendered":"<p>iostat \/ vmstat \/ mpstat are some tools to monitor server performance.  <\/p>\n<p> * iostat reports CPU, disk I\/O, and NFS statistics.<\/p>\n<p> * vmstat reports virtual memory statistics.<\/p>\n<p> *  mpstat reports processors statictics.<\/p>\n<p>iostat <\/p>\n<p>Iostat without any argument displays information about the CPU usage, and I\/O statistics about all the partitions on the system are showing:<\/p>\n<p> # iostat <\/p>\n<p>Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03\/11\/2012<\/p>\n<p>avg-cpu:  %user   %nice  %system %iowait  %steal   %idle<br \/>\n                  1.98     17.92    8.59       0.33       0.00       71.17<\/p>\n<p>Device:            tps      Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn<br \/>\nsda                13.89        33.54         365.15       14323873   155932064<br \/>\nsda1              13.84        32.34         363.73       13808779   155327336<br \/>\nsda2               0.05         1.20           1.42           514566       604728<\/p>\n<p>Display only cpu statistics<\/p>\n<p># iostat -c<\/p>\n<p>Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03\/11\/2012<\/p>\n<p>avg-cpu:  %user   %nice %system %iowait  %steal   %idle<br \/>\n                 1.98     17.92    8.59       0.33         0.00     71.17<\/p>\n<p>Display only disk I\/O statistics<\/p>\n<p># iostat -d<\/p>\n<p>Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03\/11\/2012<\/p>\n<p>Device:         tps      Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn<br \/>\nsda              13.89        33.53         365.04     14323921  155949184<br \/>\nsda1             13.84        32.32        363.62     13808827  155344456<br \/>\nsda2              0.05         1.20          1.42          514566      604728<\/p>\n<p>Display only network statistics<\/p>\n<p>-n, displays only the device and NFS statistics.<\/p>\n<p># iostat -n<\/p>\n<p>Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03\/11\/2012<\/p>\n<p>avg-cpu:  %user   %nice %system %iowait  %steal   %idle<br \/>\n                  1.98    17.93    8.59        0.33        0.00      71.17<\/p>\n<p>Device:            tps     Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn<br \/>\nsda                 13.89       33.52        365.00     14323937    155957552<br \/>\nsda1               13.84       32.32        363.58     13808843    155352824<br \/>\nsda2                0.05        1.20          1.42         514566        604728<\/p>\n<p>Device:    rBlk_nor\/s   wBlk_nor\/s   rBlk_dir\/s   wBlk_dir\/s   rBlk_svr\/s<br \/>\n                                                                               wBlk_svr\/s    rops\/s    wops\/s<\/p>\n<p>192.168.1.4:\/home\/pac  90.67        0.00         0.00         0.00         5.33         0.00<br \/>\n192.168.1.4:\/bkp            8.74         0.00         0.00         0.00         8.74         0.00<br \/>\n192.168.1.8:\/media          0.02         0.00         0.00         0.00         0.01         0.00<\/p>\n<p>Display I\/O data in MB\/second<\/p>\n<p>By default iostat, displays the device I\/O statistics in Blocks. To change it to MB, use -m as shown   <\/p>\n<p># iostat -m<\/p>\n<p>Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03\/11\/2012<\/p>\n<p>avg-cpu:  %user   %nice %system %iowait  %steal   %idle<br \/>\n                  1.98     17.93    8.59     0.33          0.00     71.16<\/p>\n<p>Device:           tps    MB_read\/s   MB_wrtn\/s    MB_read    MB_wrtn<br \/>\nsda               13.88     0.02            0.18              6994           76165<br \/>\nsda1             13.83     0.02            0.18              6742           75869<br \/>\nsda2              0.05      0.00            0.00               251             295<\/p>\n<p>Display I\/O statistics only for a device<\/p>\n<p># iostat -p sda<\/p>\n<p>Display timestamp information<\/p>\n<p># iostat -t<\/p>\n<p>Linux 2.6.18-164.el5 (cloudcc.ctechz.blogspot.com)     03\/11\/2012<\/p>\n<p>Time: 05:51:24 PM<br \/>\navg-cpu:  %user   %nice  %system %iowait  %steal   %idle<br \/>\n               1.98     17.93    8.59      0.33        0.00     71.16<\/p>\n<p>Device:         tps      Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn<br \/>\nsda              13.88        33.49        364.77        14324049   156006600<br \/>\nsda1             13.83        32.29        363.35        13808955   155401872<br \/>\nsda2              0.05         1.20          1.41           514566      604728<\/p>\n<p>Execute Every x seconds &#8211; y number of times<\/p>\n<p># iostat 2<br \/>\n# iostat 2 3 &#8212; execute every 2 seconds for 3 times<\/p>\n<p>Display LVM statistic<\/p>\n<p># iostat -N<\/p>\n<p># vmstat<\/p>\n<p> procs &#8212;&#8212;&#8212;&#8211;memory&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;          &#8212;swap&#8211; &#8212;&#8212;io&#8212;- &#8212;system&#8211; &#8212;&#8211;cpu&#8211;<br \/>\n r  b    swpd     free     buff        cache   si   so    bi    bo   in   cs us sy id wa st<br \/>\n 1  0  196112  75232 151884 611352   0    0     8     91   45   40 20  9 71  0  0<\/p>\n<p> vmstat output contains the following fields:<\/p>\n<p>    Procs \u2013 r: Total number of processes waiting to run<br \/>\n    Procs \u2013 b: Total number of busy processes<br \/>\n    Memory \u2013 swpd: Used virtual memory<br \/>\n    Memory \u2013 free: Free virtual memory<br \/>\n    Memory \u2013 buff: Memory used as buffers<br \/>\n    Memory \u2013 cache: Memory used as cache.<br \/>\n    Swap \u2013 si: Memory swapped from disk (for every second)<br \/>\n    Swap \u2013 so: Memory swapped to disk (for every second)<br \/>\n    IO \u2013 bi:  Blocks in. i.e blocks received from device (for every second)<br \/>\n    IO \u2013 bo:  Blocks out. i.e blocks sent to the device (for every second)<br \/>\n    System \u2013  in: Interrupts per second<br \/>\n    System \u2013  cs: Context switches<br \/>\n    CPU \u2013 us, sy, id, wa, st: CPU user time, system time, idle time, wait time<\/p>\n<p>Display active and inactive memory<br \/>\n# vmstat -a<\/p>\n<p>procs &#8212;&#8212;&#8212;&#8211;memory&#8212;&#8212;&#8212;- &#8212;swap&#8211; &#8212;&#8211;io&#8212;- &#8211;system&#8211; &#8212;&#8211;cpu&#8212;&#8212;<br \/>\n r  b   swpd   free    inact    active    si   so    bi    bo   in  cs us  sy id wa st<br \/>\n 1  0  196112  75236 224864  787620    0    0     8    91   45   41 20  9 71  0  0<\/p>\n<p>Display number of forks since last boot<\/p>\n<p>This displays all the fork system calls made by the system since the last boot.<\/p>\n<p>  # vmstat -f<br \/>\n       500235 forks  <\/p>\n<p>Execute Every x seconds<br \/>\n# vmstat 2<br \/>\n# vmstat 2 5<\/p>\n<p>Display slab info<br \/>\n# vmstat -m<\/p>\n<p>Display statistics in a table format<br \/>\n# vmstat -s<\/p>\n<p>Display disk statistics<br \/>\n# vmstat -d<\/p>\n<p>Display statistics for a partition<br \/>\n # vmstat -p \/dev\/sda1<\/p>\n<p>Display in MB<br \/>\n# vmstat -S m<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iostat \/ vmstat \/ mpstat are some tools to monitor server performance. <\/p>\n<p> * iostat reports CPU, disk I\/O, and NFS statistics.<\/p>\n<p> * vmstat reports virtual memory statistics.<\/p>\n<p> * mpstat reports processors statictics.<\/p>\n<p>iostat <\/p>\n<p>Iostat without any argument displays information about the CPU usage, and I\/O statistics about all the partitions [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2365"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2365"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2365\/revisions"}],"predecessor-version":[{"id":2367,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2365\/revisions\/2367"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}