vmstat,iostat,mpstat commands for (Performance Observation)
vmstat reports virtual memory statistics.
[root@li1250-113 ~]# yum provides */bin/vmstat
And install the package which is not there
[root@li1250-113 ~]# vmstat
procs ———–memory———- —swap— —–io—- -system– ——cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 22948 46884 70964 229908 0 0 0 4 5 7 0 0 99 0 0
vmstat output contains the following fields:
Procs – r: Total number of processes waiting to run
Procs – b: Total number of busy processes
Memory – swpd: Used virtual memory
Memory – free: Free virtual memory
Memory – buff: Memory used as buffers
Memory – cache: Memory used as cache.
Swap – si: Memory swapped from disk (for every second)
Swap – so: Memory swapped to disk (for every second)
IO – bi: Blocks in. i.e blocks received from device (for every second)
IO – bo: Blocks out. i.e blocks sent to the device (for every second)
System – in: Interrupts per second
System – cs: Context switches
CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time
Most important fields are free under memory and si, so under swap column.
Free – Amount of free/idle memory spaces.
si – Swaped in every second from disk in Kilo Bytes.
so – Swaped out every second to disk in Kilo Bytes.
[root@li1250-113 ~]# swapon -s
Filename Type Size Used Priority
/dev/xvdb partition 524284 22948 -1
With this command, vmstat execute every two seconds and stop automatically after executing four intervals.
[root@li1250-113 ~]# vmstat 2 4
procs ———–memory———- —swap– —–io—- -system– ——cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 22948 46488 71096 230276 0 0 0 4 5 7 0 0 99 0 0
0 0 22948 46488 71096 230276 0 0 0 0 32 55 0 0 100 0 0
0 0 22948 46488 71096 230276 0 0 0 20 33 57 0 0 100 0 0
0 0 22948 46488 71096 230276 0 0 0 0 28 51 0 0 100 0 0
vmstat command with -t parameter shows timestamps
[root@li1250-113 ~]# vmstat -t 2 4
procs ———–memory———- —swap– —–io—- -system– ——cpu—– —–timestamp—–
r b swpd free buff cache si so bi bo in cs us sy id wa st UTC
0 0 22948 46512 71096 230276 0 0 0 4 5 7 0 0 99 0 0 2016-04-06 05:45:21
0 0 22948 46512 71096 230276 0 0 0 0 33 56 0 0 100 0 0 2016-04-06 05:45:23
0 0 22948 46512 71096 230276 0 0 0 6 33 60 0 0 100 0 0 2016-04-06 05:45:25
0 0 22948 46512 71096 230276 0 0 0 0 28 51 0 0 100 0 0 2016-04-06 05:45:27
vmstat command and -s switch displays summary of various event counters and memory statistics.
[root@li1250-113 ~]# vmstat -s
1011432 K total memory
964916 K used memory
440540 K active memory
388624 K inactive memory
46516 K free memory
71096 K buffer memory
230276 K swap cache
524284 K total swap
22948 K used swap
501336 K free swap
544464 non-nice user cpu ticks
330 nice user cpu ticks
1234286 system cpu ticks
279663968 idle cpu ticks
10433 IO-wait cpu ticks
0 IRQ cpu ticks
9257 softirq cpu ticks
18486 stolen cpu ticks
273130 pages paged in
11681720 pages paged out
187 pages swapped in
6304 pages swapped out
99407636 interrupts
191892591 CPU context switches
1457100549 boot time
5125032 forks
vmstat with -d option display all disks statistics.
[root@li1250-113 ~]# vmstat -d
disk- ————reads———— ————writes———– —–IO——
total merged sectors ms total merged sectors ms cur sec
ram0 0 0 0 0 0 0 0 0 0 0
ram1 0 0 0 0 0 0 0 0 0 0
ram2 0 0 0 0 0 0 0 0 0 0
ram3 0 0 0 0 0 0 0 0 0 0
ram4 0 0 0 0 0 0 0 0 0 0
ram5 0 0 0 0 0 0 0 0 0 0
ram6 0 0 0 0 0 0 0 0 0 0
ram7 0 0 0 0 0 0 0 0 0 0
ram8 0 0 0 0 0 0 0 0 0 0
ram9 0 0 0 0 0 0 0 0 0 0
ram10 0 0 0 0 0 0 0 0 0 0
ram11 0 0 0 0 0 0 0 0 0 0
ram12 0 0 0 0 0 0 0 0 0 0
ram13 0 0 0 0 0 0 0 0 0 0
ram14 0 0 0 0 0 0 0 0 0 0
ram15 0 0 0 0 0 0 0 0 0 0
loop0 0 0 0 0 0 0 0 0 0 0
loop1 0 0 0 0 0 0 0 0 0 0
loop2 0 0 0 0 0 0 0 0 0 0
loop3 0 0 0 0 0 0 0 0 0 0
loop4 0 0 0 0 0 0 0 0 0 0
loop5 0 0 0 0 0 0 0 0 0 0
loop6 0 0 0 0 0 0 0 0 0 0
loop7 0 0 0 0 0 0 0 0 0 0
nbd0 0 0 0 0 0 0 0 0 0 0
nbd1 0 0 0 0 0 0 0 0 0 0
nbd2 0 0 0 0 0 0 0 0 0 0
nbd3 0 0 0 0 0 0 0 0 0 0
nbd4 0 0 0 0 0 0 0 0 0 0
nbd5 0 0 0 0 0 0 0 0 0 0
nbd6 0 0 0 0 0 0 0 0 0 0
nbd7 0 0 0 0 0 0 0 0 0 0
nbd8 0 0 0 0 0 0 0 0 0 0
nbd9 0 0 0 0 0 0 0 0 0 0
nbd10 0 0 0 0 0 0 0 0 0 0
nbd11 0 0 0 0 0 0 0 0 0 0
nbd12 0 0 0 0 0 0 0 0 0 0
nbd13 0 0 0 0 0 0 0 0 0 0
disk- ————reads———— ————writes———– —–IO——
total merged sectors ms total merged sectors ms cur sec
nbd14 0 0 0 0 0 0 0 0 0 0
nbd15 0 0 0 0 0 0 0 0 0 0
xvda 21710 220 543636 6323 1207952 1243942 23313512 187886 0 101
xvdb 162 120 2496 43 662 5642 50432 430 0 0
md0 0 0 0 0 0 0 0 0 0 0
The vmstat displays in Megabytes with parameters -S and M(Uppercase & megabytes). By default vmstat displays statistics in kilobytes.
[root@li1250-113 ~]# vmstat -S M 1 5
procs ———–memory———- —swap– —–io—- -system– ——cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 22 45 69 224 0 0 0 4 5 7 0 0 99 0 0
0 0 22 45 69 224 0 0 0 0 36 59 0 0 100 0 0
0 0 22 45 69 224 0 0 0 0 31 53 0 0 100 0 0
0 0 22 45 69 224 0 0 0 0 31 55 0 0 100 0 0
0 0 22 45 69 224 0 0 0 0 31 55 0 0 100 0 0
=====================================================================
iostat – Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.
iostat reports CPU, disk I/O, and NFS statistics.
[root@li1250-113 ~]# iostat
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.19 0.00 0.44 0.00 0.01 99.35
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.44 0.10 4.14 271570 11655192
xvdb 0.00 0.00 0.01 1248 25216
iostat with -c arguments displays only CPU statistics
[root@li1250-113 ~]# iostat -c
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.19 0.00 0.44 0.00 0.01 99.35
iostat with -d arguments displays only disks I/O statistics of all partitions
[root@li1250-113 ~]# iostat -d
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.44 0.11 4.17 319278 11737988
xvdb 0.00 0.00 0.01 1248 27020
By default it displays statistics of all partitions, with -p and device name arguments displays only disks I/O statistics for specific device only
[root@li1250-113 ~]# iostat -p sda
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.19 0.00 0.44 0.00 0.01 99.35
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
With -N (Uppercase) parameter displays only LVM statistics as shown.
[root@li1250-113 ~]# iostat -N
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.19 0.00 0.44 0.00 0.01 99.35
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.44 0.11 4.17 320294 11743532
xvdb 0.00 0.00 0.01 2740 27020
With -V (Uppercase) parameter displays version of iostat as shown.
[root@li1250-113 ~]# iostat -V
sysstat version 10.1.5
(C) Sebastien Godard (sysstat <at> orange.fr)
By default iostat, displays the device I/O statistics in Blocks. To change it to MB, use -m as shown below.
[root@li1250-113 ~]# iostat -m
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.19 0.00 0.44 0.00 0.01 99.35
Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn
xvda 0.44 0.00 0.00 312 11468
xvdb 0.00 0.00 0.00 2 26
[root@li1250-113 ~]# iostat -t
Linux 4.4.0-x86_64-linode63 (li1250-113.members.linode.com) Wednesday 06 April 2016 _x86_64_ (1 CPU)
Wednesday 06 April 2016 06:39:48 UTC
avg-cpu: %user %nice %system %iowait %steal %idle
0.19 0.00 0.44 0.00 0.01 99.35
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.44 0.11 4.17 320298 11744532
xvdb 0.00 0.00 0.01 2740 27020
