vmstat


vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

可见在想了解系统基本状况时,vmstat是一个非常不错的工具。 在Linux系统中,许多的工具其实都只是一个外壳,一个负责将Linux系统已经统计的信息以更具可读性的方式呈现出来。如果对具体的数据来源感兴趣,可以使用strace查看。

# strace -e open vmstat   // 使用strace看一下vmstat具体的数据来源

# vmstat 2 5              // 查看系统整体情况,统计间隔为2s, 统计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    468 141212 223920 447240    0    0     3     1   27   13  0  0 100  0  0

# vmstat -d 2 5           // 查看磁盘相关信息统计
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
sda   153053    967 3794370   57989 234060  31639 6015252  625080      0    578

另外多说一句,vmstat这样的输出结果,非常容易进行文本处理进行格式化。比如进行简单处理后就可以生成符合graphite/grafana输入格式的数据,从而可以使用vmstat + graphite的组合对系统进行监控。

results matching ""

    No results matching ""