{"id":2222,"date":"2013-07-12T11:09:13","date_gmt":"2013-07-12T03:09:13","guid":{"rendered":"http:\/\/rmohan.com\/?p=2222"},"modified":"2013-07-12T11:09:13","modified_gmt":"2013-07-12T03:09:13","slug":"iostat-vmstat-and-mpstat-examples","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2222","title":{"rendered":"iostat, vmstat and mpstat examples"},"content":{"rendered":"<h1>This article provides a total of 24 examples on iostat, vmstat, and mpstat commands.<\/h1>\n<ul>\n<li>iostat reports CPU, disk I\/O, and NFS statistics.<\/li>\n<li>vmstat reports virtual memory statistics.<\/li>\n<li>mpstat reports processors statictics.<\/li>\n<\/ul>\n<div>This article is part of our ongoing Linux performance monitoring series.<\/div>\n<div>Please note that iostat and vmstat are part of the sar utility. You should install sysstat package as explained in our\u00a0<a href=\"http:\/\/www.thegeekstuff.com\/2011\/03\/sar-examples\/\" target=\"_blank\">sar<\/a>\u00a0(sysstat) article to get iostat and vmstat working.<\/div>\n<h2><b>IOSTAT EXAMPLES<\/b><\/h2>\n<h3>1. iostat \u2013 Basic example<\/h3>\n<div>Iostat without any argument displays information about the CPU usage, and I\/O statistics about all the partitions on the system as shown below.<\/div>\n<pre>$ iostat\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:            tps   Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn\r\nsda             194.72      1096.66      1598.70 2719068704 3963827344\r\nsda1            178.20       773.45      1329.09 1917686794 3295354888\r\nsda2             16.51       323.19       269.61  801326686  668472456\r\nsdb             371.31       945.97      1073.33 2345452365 2661206408\r\nsdb1            371.31       945.95      1073.33 2345396901 2661206408\r\nsdc             408.03       207.05       972.42  513364213 2411023092\r\nsdc1            408.03       207.03       972.42  513308749 2411023092<\/pre>\n<h3>2. iostat \u2013 Display only cpu statistics<\/h3>\n<div>iostat option -c, displays only the CPU usage statistics as shown below.<\/div>\n<pre>$ iostat -c\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76<\/pre>\n<h3>3. iostat \u2013 Display only disk I\/O statistics<\/h3>\n<div>iostat option -d, displays only the disk I\/O statistics as shown below.<\/div>\n<pre>$ iostat -d\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\nDevice:            tps   Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn\r\nsda             194.71      1096.61      1598.63 2719068720 3963827704\r\nsda1            178.20       773.41      1329.03 1917686810 3295355248\r\nsda2             16.51       323.18       269.60  801326686  668472456\r\nsdb             371.29       945.93      1073.28 2345452365 2661209192\r\nsdb1            371.29       945.91      1073.28 2345396901 2661209192\r\nsdc             408.01       207.04       972.38  513364213 2411024484\r\nsdc1            408.01       207.02       972.38  513308749 2411024484<\/pre>\n<h3>4. iostat \u2013 Display only network statistics<\/h3>\n<div>iostat option -n, displays only the device and NFS statistics as shown below.<\/div>\n<pre>$ iostat -n\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)        07\/09\/2011\r\n\r\navg-cpu:  %user   %nice    %sys %iowait   %idle\r\n           4.33    0.01    1.16    0.31   94.19\r\n\r\nDevice:            tps   Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn\r\nsda               2.83         0.35         5.39   29817402  457360056\r\nsda1              3.32        50.18         4.57 4259963994  387641400\r\nsda2              0.20         0.76         0.82   64685128   69718576\r\nsdb               6.59        15.53        42.98 1318931178 3649084113\r\nsdb1             11.80        15.53        42.98 1318713382 3649012985\r\n\r\nDevice:                  rBlk_nor\/s   wBlk_nor\/s   rBlk_dir\/s   wBlk_dir\/s   rBlk_svr\/s   wBlk_svr\/s\r\n192.168.1.4:\/home\/data      90.67        0.00         0.00         0.00         5.33         0.00\r\n192.168.1.4:\/backup         8.74         0.00         0.00         0.00         8.74         0.00\r\n192.168.1.8:\/media          0.02         0.00         0.00         0.00         0.01         0.00<\/pre>\n<h3>5. iostat \u2013 Display I\/O data in MB\/second<\/h3>\n<div>By default iostat, displays the device I\/O statistics in Blocks. To change it to MB, use -m as shown below.<\/div>\n<pre>$ iostat -m\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:            tps    MB_read\/s    MB_wrtn\/s    MB_read    MB_wrtn\r\nsda             194.70         0.54         0.78    1327670    1935463\r\nsda1            178.19         0.38         0.65     936370    1609060\r\nsda2             16.51         0.16         0.13     391272     326402\r\nsdb             371.27         0.46         0.52    1145240    1299425\r\nsdb1            371.27         0.46         0.52    1145213    1299425\r\nsdc             407.99         0.10         0.47     250666    1177259\r\nsdc1            407.99         0.10         0.47     250639    1177259<\/pre>\n<h3>6. iostat \u2013 Display I\/O statistics only for a device<\/h3>\n<div>By default iostat displays I\/O data for all the disks available in the system. To view statistics for a specific device (For example, \/dev\/sda), use the option -p as shown below.<\/div>\n<pre>$ iostat -p sda\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:            tps   Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn\r\nsda             194.69      1096.51      1598.48 2719069928 3963829584\r\nsda2            336.38        27.17        54.00   67365064  133905080\r\nsda1            821.89         0.69       243.53    1720833  603892838<\/pre>\n<h3>7. iostat \u2013 Display timestamp information<\/h3>\n<div>By default iostat displays only the current date. To display the current time, use the option -t as shown below.<\/div>\n<pre>$ iostat -t\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\nTime: 08:57:52 AM\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:            tps   Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn\r\nsda             194.69      1096.49      1598.45 2719070384 3963829704\r\nsda1            178.18       773.32      1328.88 1917688474 3295357248\r\nsda2             16.51       323.14       269.57  801326686  668472456\r\nsdb             371.25       945.82      1073.16 2345452741 2661228872\r\nsdb1            371.25       945.80      1073.16 2345397277 2661228872\r\nsdc             407.97       207.02       972.27  513364233 2411030200\r\nsdc1            407.97       207.00       972.27  513308769 2411030200<\/pre>\n<h3>8. iostat \u2013 Display Extended status<\/h3>\n<div>Use option -x, which will displays extended disk I\/O statistics information as shown below.<\/div>\n<pre>$ iostat -x\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:         rrqm\/s   wrqm\/s   r\/s   w\/s   rsec\/s   wsec\/s avgrq-sz avgqu-sz   await  svctm  %util\r\nsda              27.86    63.53 61.77 132.91  1096.46  1598.40    13.84     0.21    1.06   2.28  44.45\r\nsda1              0.69    33.22 48.54 129.63   773.30  1328.84    11.80     1.39    7.82   2.28  40.57\r\nsda2             27.16    30.32 13.23  3.28   323.13   269.56    35.90     0.55   32.96   3.44   5.68\r\nsdb              39.15   215.16 202.20 169.04   945.80  1073.13     5.44     1.05    2.78   1.64  60.91\r\nsdb1             39.15   215.16 202.20 169.04   945.77  1073.13     5.44     1.05    2.78   1.64  60.91\r\nsdc               8.90     3.63 356.56 51.40   207.01   972.24     2.89     1.04    2.56   1.55  63.30\r\nsdc1              8.90     3.63 356.55 51.40   206.99   972.24     2.89     1.04    2.56   1.55  63.30<\/pre>\n<div>To display extended information for a specific partition (For example, \/dev\/sda1), do the following.<\/div>\n<pre>$ iostat -x sda1\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:         rrqm\/s   wrqm\/s   r\/s   w\/s   rsec\/s   wsec\/s avgrq-sz avgqu-sz   await  svctm  %util\r\nsda1              0.69    33.21 48.54 129.62   773.23  1328.76    11.80     1.39    7.82   2.28  40.56<\/pre>\n<h3>9. iostat \u2013 Execute Every x seconds (for y number of times)<\/h3>\n<div>To execute iostat every 2 seconds (until you press Ctl-C), do the following.<\/div>\n<pre>$ iostat 2\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\r\n           5.68    0.00    0.52    2.03    0.00   91.76\r\n\r\nDevice:            tps   Blk_read\/s   Blk_wrtn\/s   Blk_read   Blk_wrtn\r\nsda             194.67      1096.39      1598.33 2719070584 3963891256\r\nsda1            178.16       773.26      1328.79 1917688482 3295418672\r\nsda2             16.51       323.11       269.54  801326878  668472584\r\nsdb             371.22       945.74      1073.08 2345454041 2661251200\r\nsdb1            371.22       945.72      1073.08 2345398577 2661251200\r\nsdc             407.93       207.00       972.19  513366813 2411036564\r\nsdc1            407.93       206.98       972.19  513311349 2411036564\r\n..<\/pre>\n<div>To execute every 2 seconds for a total of 3 times, do the following.<\/div>\n<pre>$ iostat 2 3<\/pre>\n<h3>10. iostat \u2013 Display LVM statistic (and version)<\/h3>\n<div>To display the LVM statistics use option -N as shown below.<\/div>\n<pre>$ iostat -N<\/pre>\n<div>To display the version of iostat, use -V. This will really display the version information of sysstat, as iostat is part of sysstat package.<\/div>\n<pre>$ iostat -V\r\nsysstat version 7.0.2<\/pre>\n<h2><b>VMSTAT EXAMPLES<\/b><\/h2>\n<h3>11. vmstat \u2013 Basic example<\/h3>\n<div>vmstat by default will display the memory usage (including swap) as shown below.<\/div>\n<pre>$ vmstat\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 0  0 305416 260688  29160 2356920    2    2     4     1    0    0  6  1 92  2  0<\/pre>\n<div>vmstat output contains the following fields:<\/div>\n<ul>\n<li>Procs \u2013 r: Total number of processes waiting to run<\/li>\n<li>Procs \u2013 b: Total number of busy processes<\/li>\n<li>Memory \u2013 swpd: Used virtual memory<\/li>\n<li>Memory \u2013 free: Free virtual memory<\/li>\n<li>Memory \u2013 buff: Memory used as buffers<\/li>\n<li>Memory \u2013 cache: Memory used as cache.<\/li>\n<li>Swap \u2013 si: Memory swapped from disk (for every second)<\/li>\n<li>Swap \u2013 so: Memory swapped to disk (for every second)<\/li>\n<li>IO \u2013 bi: Blocks in. i.e blocks received from device (for every second)<\/li>\n<li>IO \u2013 bo: Blocks out. i.e blocks sent to the device (for every second)<\/li>\n<li>System \u2013 in:\u00a0Interrupts\u00a0per second<\/li>\n<li>System \u2013 cs: Context switches<\/li>\n<li>CPU \u2013 us, sy, id, wa, st: CPU user time, system time, idle time, wait time<\/li>\n<\/ul>\n<h3>12. vmstat \u2013 Display active and inactive memory<\/h3>\n<div>By default vmstat doesn\u2019t display this information. Use option -a, to display active and inactive memory information as shown below.<\/div>\n<pre>$ vmstat -a\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\r\n r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st\r\n 0  0 305416 253820 1052680 2688928    2    2     4     1    0    0  6  1 92  2  0<\/pre>\n<h3>13. vmstat \u2013 Display number of forks since last boot<\/h3>\n<div>This displays all the fork system calls made by the system since the last boot. This displays all fork, vfork, and clone system call counts.<\/div>\n<pre>$ vmstat -f\r\n     81651975 forks<\/pre>\n<h3>14. vmstat \u2013 Execute Every x seconds (for y number of times)<\/h3>\n<div>To execute every 2 seconds, do the following. You have to press Ctrl-C to stop this.<\/div>\n<pre>$ vmstat 2\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 1  0      0 537144 182736 6789320    0    0     0     0    1    1  0  0 100  0  0\r\n 0  0      0 537004 182736 6789320    0    0     0     0   50   32  0  0 100  0  0\r\n..<\/pre>\n<div>To execute every 2 seconds for 10 times, do the following. You don\u2019t need to press Ctrl-C in this case. After executing 10 times, it will stop automatically.<\/div>\n<pre>$ vmstat 2 10\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 1  0      0 537144 182736 6789320    0    0     0     0    1    1  0  0 100  0  0\r\n 0  0      0 537004 182736 6789320    0    0     0     0   50   32  0  0 100  0  0\r\n..<\/pre>\n<h3>15. vmstat \u2013 Display timestamp<\/h3>\n<div>When you use vmstat to monitor the memory usage repeately, it would be nice to see the timestap along with every line item. Use option -t to display the time stamp as shown below.<\/div>\n<pre>$ vmstat -t 1 100\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp---\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 0  0      0 3608728 148368 3898200    0    0     0     0    1    1  0  0 100  0  0     2011-07-09 21:16:28 PDT\r\n 0  0      0 3608728 148368 3898200    0    0     0     0   60   15  0  0 100  0  0     2011-07-09 21:16:29 PDT\r\n 0  0      0 3608712 148368 3898200    0    0     0     0   32   28  0  0 100  0  0     2011-07-09 21:16:30 PDT<\/pre>\n<div>For me, the timestamp option worked in the following version.<\/div>\n<pre>$ vmstat -V\r\nprocps version 3.2.8<\/pre>\n<div>Note:\u00a0If you use a older version of vmstat, option -t might not be available. In that case, use the method we suggested earlier to\u00a0<a href=\"http:\/\/www.thegeekstuff.com\/2009\/08\/how-to-add-timestamp-to-unix-vmstat-command-output\/\" target=\"_blank\">display timestamp in vmstat<\/a>output.<\/div>\n<h3>16. vmstat \u2013 Display slab info<\/h3>\n<div>Use option -m, to display the slab info as shown below.<\/div>\n<pre>$ vmstat -m\r\nCache                       Num  Total   Size  Pages\r\nfib6_nodes                    5    113     32    113\r\nip6_dst_cache                 4     15    256     15\r\nndisc_cache                   1     15    256     15\r\nRAWv6                         7     10    768      5\r\nUDPv6                         0      0    640      6\r\ntw_sock_TCPv6                 0      0    128     30\r\n...<\/pre>\n<h3>17. vmstat \u2013 Display statistics in a table format<\/h3>\n<div>Instead of displays the values in the record format, you can display the output of vmstat in table format using option -s as shown below.<\/div>\n<pre>$ vmstat -s\r\n      4149928  total memory\r\n      3864824  used memory\r\n      2606664  active memory\r\n      1098180  inactive memory\r\n       285104  free memory\r\n        19264  buffer memory\r\n      2326692  swap cache\r\n      4192956  total swap\r\n       274872  used swap\r\n      3918084  free swap\r\n   1032454000 non-nice user cpu ticks\r\n        14568 nice user cpu ticks\r\n     89482270 system cpu ticks\r\n  16674327143 idle cpu ticks\r\n    368965706 IO-wait cpu ticks\r\n      1180468 IRQ cpu ticks\r\n..<\/pre>\n<h3>18. vmstat \u2013 Display disk statistics<\/h3>\n<div>Use option -d to display the disk statistics as shown below. This displays the reads, writes, and I\/O statistics of the disk.<\/div>\n<pre>$ vmstat -d\r\ndisk- ------------reads------------ ------------writes----------- -----IO------\r\n       total merged sectors      ms  total merged sectors      ms    cur    sec\r\nsda   153189971 69093708 2719150864 737822879 329617713 157559204 3965687592 4068577985      0 1102243\r\nsdb   501426305 97099356 2345472425 731613156 419220973 533565961 2661869460 1825174087      0 1510434\r\nsdc   884213459 22078974 513390701 452540172 127474901 8993357 2411187300 2133226954      0 1569758<\/pre>\n<h3>19. vmstat \u2013 Increase the width of the display<\/h3>\n<div>The default output without increasing the width is shown below.<\/div>\n<pre>$ vmstat 1 3\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 0  0      0 3608688 148368 3898204    0    0     0     0    1    1  0  0 100  0  0\r\n 0  0      0 3608804 148368 3898204    0    0     0     0   72   30  0  0 100  0  0\r\n 0  0      0 3608804 148368 3898204    0    0     0     0   60   27  0  0 100  0  0<\/pre>\n<div>Use option -w to increase the width of the output columns as shown below. This give better readability.<\/div>\n<pre>$ vmstat -w 1 3\r\nprocs -------------------memory------------------ ---swap-- -----io---- --system-- -----cpu-------\r\n r  b       swpd       free       buff      cache   si   so    bi    bo   in   cs  us sy  id wa st\r\n 0  0          0    3608712     148368    3898204    0    0     0     0    1    1   0  0 100  0  0\r\n 0  0          0    3608712     148368    3898204    0    0     0     0   93   23   0  0 100  0  0\r\n 0  0          0    3608696     148368    3898204    0    0     0     0   35   34   0  0 100  0  0<\/pre>\n<h3>20. vmstat \u2013 Display statistics for a partition<\/h3>\n<div>To display the disk I\/O statistics of a specific disk partition use option -p as shown below.<\/div>\n<pre>$ vmstat -p sdb1\r\nsdb1          reads   read sectors  writes    requested writes\r\n           501423248 2345417917  419221612 2661885948<\/pre>\n<h3>21. vmstat \u2013 Display in MB<\/h3>\n<div>By default vmstat displays the memory information in kb. To disply in MB, use the option \u201c-S m\u201d as shown below.<\/div>\n<pre>$ vmstat -S m\r\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 0  0    281    288     19   2386    0    0     4     1    0    0  6  1 92  2  0<\/pre>\n<h2><b>MPSTAT EXAMPLES<\/b><\/h2>\n<h3>22. mpstat \u2013 Display basic info<\/h3>\n<div>By default mpstat displays CPU statistics as shown below.<\/div>\n<pre>$ mpstat\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011\r\n\r\n10:25:32 PM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr\/s\r\n10:25:32 PM  all    5.68    0.00    0.49    2.03    0.01    0.02    0.00   91.77    146.55<\/pre>\n<h3>23. mpstat \u2013 Display all information<\/h3>\n<div>Option -A, displays all the information that can be displayed by the mpstat command as shown below. This is really equalivalent to \u201cmpstat -I ALL -u -P ALL\u201d command.<\/div>\n<pre>$ mpstat -A\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011      _x86_64_        (4 CPU)\r\n\r\n10:26:34 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle\r\n10:26:34 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.99\r\n10:26:34 PM    0    0.01    0.00    0.01    0.01    0.00    0.00    0.00    0.00   99.98\r\n10:26:34 PM    1    0.00    0.00    0.01    0.00    0.00    0.00    0.00    0.00   99.98\r\n10:26:34 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00\r\n10:26:34 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00\r\n\r\n10:26:34 PM  CPU    intr\/s\r\n10:26:34 PM  all     36.51\r\n10:26:34 PM    0      0.00\r\n10:26:34 PM    1      0.00\r\n10:26:34 PM    2      0.04\r\n10:26:34 PM    3      0.00\r\n\r\n10:26:34 PM  CPU     0\/s     1\/s     8\/s     9\/s    12\/s    14\/s    15\/s    16\/s    19\/s    20\/s    21\/s    33\/s   NMI\/s   LOC\/s   SPU\/s   PMI\/s   PND\/s   RES\/s   CAL\/s   TLB\/s   TRM\/s   THR\/s   MCE\/s   MCP\/s   ERR\/s   MIS\/s\r\n10:26:34 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    7.47    0.00    0.00    0.00    0.00    0.02    0.00    0.00    0.00    0.00    0.00    0.00    0.00\r\n10:26:34 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    4.90    0.00    0.00    0.00    0.00    0.03    0.00    0.00    0.00    0.00    0.00    0.00    0.00\r\n10:26:34 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.04    0.00    0.00    0.00    0.00    0.00    3.32    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00\r\n10:26:34 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    4.17    0.00    0.00    0.00    0.00    0.01    0.00    0.00    0.00    0.00    0.00    0.00    0.00<\/pre>\n<h3>24. mpstat \u2013 Display CPU statistics of individual CPU (or) Core<\/h3>\n<div>Option -P ALL, displays all the individual CPUs (or Cores) along with its statistics as shown below.<\/div>\n<pre>$ mpstat -P ALL\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011      _x86_64_        (4 CPU)\r\n\r\n10:28:04 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle\r\n10:28:04 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.99\r\n10:28:04 PM    0    0.01    0.00    0.01    0.01    0.00    0.00    0.00    0.00   99.98\r\n10:28:04 PM    1    0.00    0.00    0.01    0.00    0.00    0.00    0.00    0.00   99.98\r\n10:28:04 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00\r\n10:28:04 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00<\/pre>\n<div>To display statistics information of a particular CPU (or core), use option -P as shown below.<\/div>\n<pre>$ mpstat -P 0\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011      _x86_64_        (8 CPU)\r\n\r\n10:28:53 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle\r\n10:28:53 PM    0    0.01    0.00    0.01    0.01    0.00    0.00    0.00    0.00   99.98\r\n\r\n$ mpstat -P 1\r\nLinux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07\/09\/2011      _x86_64_        (8 CPU)\r\n\r\n10:28:55 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle\r\n10:28:55 PM    1    0.00    0.00    0.01    0.00    0.00    0.00    0.00    0.00   99.98<\/pre>\n<div>Finally, as we mentioned earlier mpstat is part of the sysstat package. When you do mpstat -V, it will really display the version number of the systat package as shown below.<\/div>\n<pre>$ mpstat -V<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article provides a total of 24 examples on iostat, vmstat, and mpstat commands. iostat reports CPU, disk I\/O, and NFS statistics. vmstat reports virtual memory statistics. mpstat reports processors statictics. This article is part of our ongoing Linux performance monitoring series. Please note that iostat and vmstat are part of the sar utility. You [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2222"}],"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=2222"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2222\/revisions"}],"predecessor-version":[{"id":2224,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2222\/revisions\/2224"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}