Echoshell
  • Selfservice book
  • MacBook Setup
  • Linux SystemAdmin
    • Linux useful commands
    • Analyze tools
      • Hardware overview
      • Vmstat
      • Top
      • Sar
      • ltrace
      • strace
      • Netstat/SS
      • lsof
      • iostat
      • iotop
    • Performance Tuning
      • CPU
      • Momory
      • Disk/Storage
      • Network
      • Process
  • SRE vs DevOps
    • Ansible
    • Git
    • Jenkins
    • HashiCorp-Terraform
      • Terraform VS. CloudFormation
      • Main elements
        • Provider
        • State Storage and Locking
        • Backends
      • Basic Elements
        • Install
        • Resource
        • Data
        • Output
        • Locals
      • Commands
        • terraform plan
        • terraform apply
        • terraform import
    • HashiCorp-Vault
    • HashiCorp-Consul
    • CI/CD
      • GoCD
  • Automation/Script Language
    • Shell&Bash
      • Useful links
    • Python
      • 基础
        • py2 vs py3
        • 字符编码
        • 输入和输出
      • 数据类型Data Types
        • 字符串String
        • 列表List
        • 元组Tuple
        • 字典Dict
        • 集合Set
      • 函数Function
        • 定义函数
        • 函数参数
      • 函数式编程
        • 匿名函数lamba
        • map/reduce/filter
        • 闭包
        • 装饰器
      • 类Class
        • 类和实例
        • 继承和多态
        • 类方法和静态方法
        • 定制类和魔法方法
        • 元类-陌生的 metaclass
      • 高级特性
        • 迭代器iterator
        • 生成器generator
        • 上下文管理
      • 文件和目录
        • 读写文本文件
        • os 模块
      • 进程、线程和协程
        • 进程
        • 线程
        • ThreadLocal
        • 协程
      • 异常处理Exception
      • 正则表达式Regular-Expressions
        • re 模块
      • 标准模块
        • datetime
        • argparse
      • 第三方模块Three Parts
        • Click
        • JIRA
        • Email
        • Jenkins
      • 系统相关模块System modules
        • Subprocess
        • shutil
  • Learning notes from organization
  • IT Tech Team Leader/Senior System administrator
    • Helpdesk
    • Windows Servers
      • Radius Server
      • NFS
      • Munki
      • 802.1X
    • Networks
  • Personal views and ideas from my careen path
    • Team management
    • Career path change from IT to devops
Powered by GitBook
On this page

Was this helpful?

  1. Linux SystemAdmin
  2. Analyze tools

Vmstat

PreviousHardware overviewNextTop

Last updated 5 years ago

Was this helpful?

* running cpu, block cpu
    * r: The number of processes waiting for run time.
    * b:  The number of processes in uninterruptible sleep.
* memory usage
* swap 
* io - input/ouput
    * 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 - 
    * wa: Time spent waiting for IO
    * sy: Time spent running kernel code. (system time)
    * us: Time spent running non-kernel code. (user time, including nice time)
* -d  show disk reads/wirtes/IO

vmstat 2 10 - To execute every 2 seconds for 10 times

root@shubuntu  ~  vmstat 2 10                                                                                                                                  ✔  ⚡  79  06:19:23
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      0  75604  62252 678656    0    0     3     1    2    2  0  0 100  0  0
 0  0      0  75572  62252 678656    0    0     0     0 8326   59  0  0 100  0  0
 0  0      0  75416  62260 678648    0    0     0    18 8332   73  0  0 100  0  0
 0  0      0  75416  62260 678652    0    0     0     0 8318   54  0  0 100  0  0
 0  0      0  75480  62260 678660    0    0     0     0 8360   83  0  0 100  0  0
 0  0      0  75480  62260 678660    0    0     0     0 8343   70  0  0 100  0  0
 0  0      0  75448  62260 678660    0    0     0     0 8314   50  0  0 100  0  0
 0  0      0  75448  62260 678660    0    0     0     0 8316   53  0  0 100  0  0
 0  0      0  75448  62260 678660    0    0     0     0 8317   54  0  0 100  0  0
 0  0      0  75448  62260 678660    0    0     0     0 8387   98  0  0 100  0  0

vmstat -d Use option -d to display the disk statistics as shown below. This displays the reads, writes, and I/O statistics of the disk.

disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
loop246      0      0       0       0      0      0       0       0      0      0
loop247      0      0       0       0      0      0       0       0      0      0
loop248      0      0       0       0      0      0       0       0      0      0
loop249      0      0       0       0      0      0       0       0      0      0
loop250      0      0       0       0      0      0       0       0      0      0
loop251      0      0       0       0      0      0       0       0      0      0
loop252      0      0       0       0      0      0       0       0      0      0
loop253      0      0       0       0      0      0       0       0      0      0
loop254      0      0       0       0      0      0       0       0      0      0
loop255      0      0       0       0      0      0       0       0      0      0
mmcblk0 530279  59623 81553879 10060460 435303 483137 75710389 160397208      0   6750

vmstat -w 1 3 Use option -w to increase the width of the output columns as shown below. This give better readability.

[root@test-101 ~]# vmstat -w 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
 0  0          0     380824     128092     112736    0    0     2    23    2    1   1  0  99  0  0
 0  0          0     380800     128092     112736    0    0     0     0  122  107   0  0 100  0  0
 0  0          0     380800     128092     112736    0    0     0     0   99  108   0  0 100  0  0

vmstat -s

[root@-test-101 ~]# vmstat -s
      3924252  total memory
      3543552  used memory
       769468  active memory
        67748  inactive memory
       380700  free memory
       128096  buffer memory
       112736  swap cache
            0  total swap
            0  used swap
            0  free swap
      8481222 non-nice user cpu ticks
         7592 nice user cpu ticks
      3207888 system cpu ticks
   1483602447 idle cpu ticks
      4182278 IO-wait cpu ticks
          315 IRQ cpu ticks
        62822 softirq cpu ticks
            0 stolen cpu ticks
     35727801 pages paged in
    337614829 pages paged out
            0 pages swapped in
            0 pages swapped out
    884076676 interrupts
   1003530568 CPU context switches
   1558424336 boot time
      1229129 fork