1:经常使用输出例子shell
$ vmstat 输出间隔秒数 输出次数服务器
[root@localhost ~]# vmstat 1 4 #每一秒输出系统状态,共输出4次 1 2 3 4 5 6 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 0 751456 764 70252 0 0 132 12 49 114 0 1 98 1 0 #第一行是自服务器启动到至今的全部指标的平均值,而非最新状态,第一行数据不可靠。 0 0 0 751416 764 70284 0 0 0 0 10 16 0 0 100 0 0 0 0 0 751416 764 70284 0 0 0 0 11 14 0 0 100 0 0 0 0 0 751416 764 70284 0 0 0 0 11 13 0 0 100 0 0 # r:进程运行队列中的进程个数 # b:处于不可中断的睡眠状态中的进程个数 # swpd:虚拟内存的使用量 # free:空闲内存量(不含buffers和cached) # buff:内存中buffers的使用量 # si:每秒从交换分区(磁盘)写入内存的量 # so: 每秒从内存写入交换分区(磁盘)的量 # bi :每秒从块设备 读取到 内存的 块(block)数量 # bo:每秒 从内存 中 写入到 块设备的 块数量 # in:每秒中断次数 # cs:每秒上下文切换次数 # us :用户进程CPU消耗时间的百分比 # sy :内核进程消耗时间百分比 # id :CPU空闲状态时间百分比 # wa :IO等待消耗时间百分比 # st : Time stolen from a virtual machine
2:-a 查看正在被使用的内存工具
[root@localhost ~]# vmstat -a 1 4 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free inact active si so bi bo in cs us sy id wa st 2 0 0 738744 61196 82396 0 0 29 3 17 35 0 0 100 0 0 0 0 0 738704 61196 82408 0 0 0 0 10 16 0 0 100 0 0 0 0 0 738704 61196 82408 0 0 0 0 13 14 0 0 100 0 0 0 0 0 738704 61196 82408 0 0 0 0 9 12 0 0 100 0 0 # inact: the amount of inactive memory. # active :正在被使用的内存
3: -f 统计服务器曾有多少给forks性能
[root@localhost ~]# vmstat -f 2730 forks
4:-m 展现内存slab信息code
[root@localhost ~]# vmstat -m
5: -s 展现内存指标以及系统事件信息 -------很是有用队列
[root@localhost ~]# vmstat -s
6:-d 展现各个磁盘的统计信息进程
[root@localhost ~]# vmstat -d disk- ------------reads------------ ------------writes----------- -----IO------ total merged sectors ms total merged sectors ms cur sec sda 5846 669 182177 22395 2826 177 21324 582 0 13 sr0 12 0 96 170 0 0 0 0 0 0 dm-0 4041 0 169371 21831 952 0 17226 552 0 12 dm-1 216 0 1728 636 0 0 0 0 0 0
7:-p 展现某一个特定分区的I/O信息事件
[root@localhost ~]# vmstat -p /dev/sda2 sda2 reads read sectors writes requested writes 3691 172011 777 17229