vmstat 监视内存使用情况

vmstat 监视内存使用情况

一、vmstat介绍

vmstat:显示虚拟内存状态,可以报告关于进程、内存、IO等系统整体运行状态。

二、vmstat选项

[root@host-39-108-217-12 ~]# vmstat --help

Usage:
vmstat [选项] [参数]

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

-a:显示活动内页;
-f:显示启动后创建的进程总数;
-m:显示slab信息;
-n:头信息仅显示一次;
-s:以表格方式显示事件计数器和内存状态;
-d:报告磁盘状态;
-p:显示指定的硬盘分区状态;
-S:输出信息的单位。

三、实例

实例一:打印时间
[root@host-39-108-217-12 ~]# vmstat -t  
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- -----timestamp-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st                 CST
 3  0      0 125564  92752 298696    0    0     4   186   37   27  1  1 98  0  0 2018-06-25 20:17:04

实例二:以表格方式显示事件计数器和内存状态
[root@host-39-108-217-12 ~]# vmstat -s
      1016164 K total memory
       499084 K used memory
       626608 K active memory
       167440 K inactive memory
       125308 K free memory
        92964 K buffer memory
       298808 K swap cache
            0 K total swap
            0 K used swap
            0 K free swap
      1166563 non-nice user cpu ticks
          188 nice user cpu ticks
       638125 system cpu ticks
    104886240 idle cpu ticks
       397132 IO-wait cpu ticks
            0 IRQ cpu ticks
        18659 softirq cpu ticks
            0 stolen cpu ticks
      4043689 pages paged in
    198892888 pages paged out
            0 pages swapped in
            0 pages swapped out
    340524007 interrupts
    458549673 CPU context switches
   1528855577 boot time
      3633074 forks

实例三:间隔1秒,执行3次
[root@host-39-108-217-12 ~]# 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 122652  94216 299756    0    0     4   186   37   27  1  1 98  0  0
 0  0      0 122156  94216 299756    0    0     0     4  361  518  1  1 98  0  0
 0  0      0 122140  94216 299756    0    0     0     8  323  441  1  0 99  0  0


实例四:显示指定磁盘分区状态
[root@host-39-108-217-12 ~]# vmstat -p  /dev/vda1
vda1          reads   read sectors  writes    requested writes
              145416    8084434    8599664  398183352

实例五:显示磁盘read/write/IO的状态
[root@host-39-108-217-12 ~]# vmstat -d
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
vda   145508    138 8088714  849814 11273776 1180892 398262960 31055145      0   4363

实例六:显示启动后创建的进程总数
[root@host-39-108-217-12 ~]# vmstat -f
  3639467 forks

四、vmstat输出选项参数详解

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

东城绝神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值