Usage:
vmstat [options] [delay [count]]
delay代表每过多少秒显示一条,count代表要显示的总条数
Options:
-a, --active active/inactive memory
-f, --forks number of forks since boot
-m, --slabs slabinfo
-n, --one-header do not redisplay header
-s, --stats event counter statistics
-d, --disk disk statistics
-D, --disk-sum summarize disk statistics
-p, --partition <dev> partition specific statistics
-S, --unit <char> define display unit
-w, --wide wide output
-t, --timestamp show timestamp
-h, --help display this help and exit
-V, --version output version information and exit
示例
[root@VM_0_6_centos ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 0 78184 77832 552156 0 0 17 36 10 2 82 1 17 0 0
[root@VM_0_6_centos ~]# vmstat 1 3
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 0 71556 76812 558964 0 0 17 36 0 2 82 1 18 0 0
0 0 0 73704 76816 558900 0 0 0 92 476 699 1 2 96 1 0
0 0 0 73704 76816 558904 0 0 0 0 428 588 1 0 99 0 0
解释
Procs
r: The number of runnable processes (running or waiting for run time).可运行的进程的个数
b: The number of processes in uninterruptible sleep.非中断状态睡眠的进程的个数,意味着阻塞进程的个数
Memory
swpd: the amount of virtual memory used. 已经使用的内存量
free: the amount of idle memory. 剩余的内存量
buff: the amount of memory used as buffers. 已经使用缓冲块的大小
cache: the amount of memory used as cache. 已经使用缓存的大小
inact: the amount of inactive memory. (-a option) 非活跃状态下的内存容量
active: the amount of active memory. (-a option) 活跃状态下的内存容量
Swap
si: Amount of memory swapped in from disk (/s). 从磁盘交换到swap虚拟内存的交换页数量,单位:KB/秒。如果这个值大于0,表示物理内存不够用或者内存泄露了
so: Amount of memory swapped to disk (/s).
从swap虚拟内存交换到磁盘的交换页数量,单位:KB/秒,如果这个值大于0,表示物理内存不够用或者内存泄露了
IO
bi: Blocks received from a block device (blocks/s).每秒从块设备接收到的块数,单位:块/秒 也就是读块设备。
bo: Blocks sent to a block device (blocks/s).每秒发送到块设备的块数,单位:块/秒 也就是写块设备。
System
in: The number of interrupts per second, including the clock. 每秒中断的次数包括时间片中断
cs: The number of context switches per second.每秒上下文交换的次数
CPU
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
用户CPU时间(非内核进程占用时间)(单位为百分比)。 us的值比较高时,说明用户进程消耗的CPU时间多
sy: Time spent running kernel code. (system time)
系统使用的CPU时间(单位为百分比)。sy的值高时,说明系统内核消耗的CPU资源多,这并不是良性表现,我们应该检查原因。
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
空闲的CPU的时间(百分比),在Linux 2.5.41之前,这部分包含IO等待时间。
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
等待IO的CPU时间,在Linux 2.5.41之前,这个值为0 .这个指标意味着CPU在等待硬盘读写操作的时间,用百分比表示。wait越大则机器io性能就越差。说明IO等待比较严重,这可能由于磁盘大量作随机访问造成,也有可能磁盘出现瓶颈(块操作)
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.