Linux vmstat命令:报告虚拟内存统计。
Linux vmstat命令 功能描述
使用vmstat命令可以对操作系统的虚拟内存、进程、分页、块I/O和CPU活动等进行监控。它是对系统的整体情况进行统计,不足之处是无法对某个进程进行深入分析。
Linux vmstat命令 语法
vmstat [选项] [时间间隔] [次数]
命令中各选项的含义如表所示。
Linux vmstat命令 示例
显示虚拟内存的使用情况
[root@rhel ~]# 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 0324116 26148339820 0 0 228 16 72 394 2 3 91 5 0
显示活跃和非活跃内存统计信息
[root@rhel ~]# vmstat -a
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free inact active si so bi bo in cs us sy id wa st
1 0 0324116222372341196 0 0 222 16 71 383 2 2 91 5 0
显示从系统启动以来的fork数量
[root@rhel ~]# vmstat -f
2691 forks
显示内存使用的详细信息
[root@rhel ~]# vmstat -s
1012548 total memory
688432 used memory
341212 active memory
222364 inactive memory
324116 free memory
26164 buffer memory
339840 swap cache
2097144 total swap
0 used swap
2097144 free swap
3016 non-nice user cpu ticks
2 nice user cpu ticks
3962 system cpu ticks
151698 idle cpu ticks
7759 IO-wait cpu ticks
23 IRQ cpu ticks
85 softirq cpu ticks
0 stolen cpu ticks
361414 pages paged in
25881 pages paged out
0 pages swapped in
0 pages swapped out
115694 interrupts
625259 CPU context switches
1376844286 boot time
2692 forks
显示磁盘相关统计信息(磁盘的读/写情况)
[root@rhel ~]# 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
sda 10444 4590 737432 164994 2183 7658 78720 110841 0 120
sr0 0 0 0 0 0 0 0 0 0 0
查看/dev/sda1磁盘分区的读/写情况
[root@rhel ~]# vmstat -p /dev/sda1
sda1 reads read sectors writes requested writes
594 4634 3 18
显示系统的slabinfo
[root@rhel ~]# vmstat -m
Cache Num Total Size Pages
fuse_request 1 9 416 9
fuse_inode 1 5 768 5
rpc_buffers 8 8 2048 2
rpc_tasks 8 15 256 15
rpc_inode_cache 8 8 832 4
nf_conntrack_expect 0 0 240 16
nf_conntrack_ffffffff81b16540 13 13 304 13
fib6_nodes 22 59 64 59
ip6_dst_cache 13 20 384 10
ndisc_cache 1 15 256 15
ip6_mrt_cache 0 0 128 30
RAWv6 67 68 1024 4
UDPLITEv6 0 0 1024 4
UDPv6 4 4 1024 4
tw_sock_TCPv6 0 0 320 12
request_sock_TCPv6 0 0 192 20
TCPv6 5 6 1856 2
jbd2_1k 0 0 1024 4
avtab_node 547979548064 24 144
ext4_inode_cache 6469 6472 1024 4
ext4_xattr 2 44 88 44
........................(省略)