vmstat

字段含义

Procs
 r: The number of processes waiting for run time. 等待执行的进程, 数字越大意味着CPU越忙, 果该数字经常大于逻辑cpu个数则CPU资源存在瓶颈
 b: The number of processes in uninterruptible sleep. 处在非中断睡眠状态的进程数, 即进程被阻塞, 主要是指被资源阻塞的进程对列数(比如IO资源, 页面调度等), 当这个值较大时需要根据应用程序来进行分析,比如数据库产品,中间件应用

Memory
swpd: the amount of virtual memory used. 已使用的虚拟内存大小. 如果虚拟内存使用较多, 可能系统的物理内存不足, 需要减少物理内存使用或增大物理内存. swapd不为0并不意味物理内存不足, 如果swapd长期稳定, si和so为0, 就是正常的
free: the amount of idle memory. 空闲的内存大小
buff: the amount of memory used as buffers.  buffer(缓存, 主要用于块设备缓存)的大小, 单位KB
cache: the amount of memory used as cache. cache(缓存, 主要用于缓存文件)的大小, 单位KB
inact: the amount of inactive memory. (-a option) 非活跃的内存大小
active: the amount of active memory. (-a option) 活跃的内存大小

Swap
si: Amount of memory swapped in from disk (/s). 从swap交换到内存的数量, 单位KB/s
so: Amount of memory swapped to disk (/s). 从内存交换到swap的数量, 单位KB/s
关于free和si, so的说明: 内存充足的时候这2个值都是0, 如果这2个值一直大于0, 会影响系统性能(因为有磁盘IO和CPU消耗). 内存是否充足要结合free和si, so一起看, 如果free小但是si和so大多时候是0, 内存就是够用的.

IO
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资源, 这个数值应该越小越好. 上下文切换数目高于中断数目,说明kernel中相当数量的时间都开销在上下文切换线程. 大量的上下文切换将导致CPU 利用率分类不均衡. 导致等待io请求的(wa)百分比非常高, 以及user time(us)百分比非常低

CPU
These are percentages of total CPU time. 以下的数值都是CPU总时间的百分比
us: Time spent running non-kernel code. (user time, including nice time): 用户CPU时间(非内核进程占用时间). us的值高说明用户进程消耗的CPU时间多
sy: Time spent running kernel code. (system time) 系统使用的CPU时间. sy的值高说明系统内核消耗的CPU资源多, 这种情况是有问题的
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. 空闲的CPU时间, 在Linux 2.5.41之前这部分包含IO等待时间
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. 等待IO的CPU时间. 在Linux 2.5.41之前这个值为0. 这个指标意味着CPU在等待硬盘读写操作的时间. wait越大则机器io性能就越差, 说明IO等待比较严重, 这可能由于磁盘大量作随机访问造成, 也有可能磁盘出现瓶颈
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

参数说明

  1. vmstat [delay] [count]

-a

  Displays active and inactive memory.
-f
  Displays the number of forks since boot. This includes the fork, vfork, and clone system calls, and is equivalent to the total number of tasks created. Each process is represented by one or more tasks, depending on thread usage. This display does not repeat.
-m
  Displays slab information.
-n
  Specifies that the header will appear once, not periodically.
-s
  Displays a table of various event counters and memory statistics. This display does not repeat. 
delay
  The delay between reports in seconds. If no delay is specified, only one report is printed, with the average values since the machine was last booted.
count
  The number of times to report on the system. If no count is specified and delay is defined, vmstat reports indefinitely.
-d
  Displays disk statistics. 每个磁盘设备为一行, 显示磁盘相关的读写统计
-p
  Takes a partition name as a value, and reports detailed statistics for that partition.
-S
  Defines the units output by the report. Valid values are k (1000 bytes), K (1024 bytes), m (1,000,000 bytes), or M (1,048,576 bytes).
-D
  Report summary statistics about disk activity.

sar, sysstat

参数说明

  1. -b Report I/O and transfer rate statistics
  2. -B Report paging statistics
  3. -d Report activity for each block device (kernels 2.4 and newer only)
  4. -H Report hugepages utilization statistics.
  5. --human Print sizes in human readable format (e.g. 1k, 1.23M, etc.)
  6. -I { int_list | SUM | ALL } Report statistics for interrupts. int_list is a list of comma-separated values or range of values (e.g., 0-16,35,400-). The SUM keyword indicates that the total number of interrupts received per second is to be displayed. The ALL keyword indicates that statistics from all interrupts, including potential APIC interrupt sources, are to be reported
  7. -m Report power management statistics
  8. -n { keyword [,...] | ALL } Report network statistics. Possible keywords are DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP, EICMP, TCP, ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 and UDP6.
  9. -P { cpu [,...] | ALL } Report per-processor statistics for the specified processor or processors.
  10. -p retty-print device names. Use this option in conjunction with option -d. By default names are printed as dev m-n where m and n are the major and minor numbers for the device.
  11. -q Report queue length and load averages.
  12. -r [ ALL ] Report memory utilization statistics. The ALL keyword indicates that all the memory fields should be displayed.内存和交换分区使用率
  13. -S Report swap space utilization statistics.
  14. -u [ ALL ] Report CPU utilization. The ALL keyword indicates that all the CPU fields should be displayed.
  15. -v Report status of inode, file and other kernel tables
  16. -W Report swapping statistics.
  17. -w Report task creation and system switching activity.
  18. -y Report TTY devices activity.

.

例子

  1. # Report CPU utilization for each 2 seconds. 5 lines are displayed.
  2. sar -u 2 5
  3.  
  4. #
  5. sar -b 1 5
  6.  
  7. #
  8. sar -q 1 3
  9.  
  10. # Report statistics on IRQ 14 for each 2 seconds. 10 lines are displayed. Data are stored in a file called int14.file.
  11. sar -I 14 -o int14.file 2 10
  12.  
  13. # Display memory and network statistics saved in daily data file 'sa16'.
  14. sar -r -n DEV -f /var/log/sysstat/sa16
  15.  
  16. # Display all the statistics saved in current daily data file.
  17. sar -A

.

其他的单项查看工具

mpstat 是专用于查看CPU状态的工具

  1. # Display five reports of global statistics among all processors at two second intervals.
  2. mpstat 2 5
  3.  
  4. # Display five reports of statistics for all processors at two second intervals.
  5. mpstat -P ALL 2 5

iostat  是用于查看CPU和设备IO状态的工具, 主要用于后者

  1. # Display a single history since boot report for all CPU and Devices.
  2. iostat
  3. # Display the CPU utilization report at two second intervals.
  4. iostat -c 2
  5. # Display a continuous device report at two second intervals.
  6. iostat -d 2
  7. # Display six reports at two second intervals for all devices.
  8. iostat -d 2 6
  9. # Display six reports of extended statistics at two second intervals for devices sda and sdb.
  10. iostat -x sda sdb 2 6
  11. # Display six reports at two second intervals for device sda and all its partitions (sda1, etc.)
  12. iostat -p sda 2 6

netstat 用于显示网络连接, 路由表, 网口状态等信息的工具

  1. -a, --all 显示所有连线中的Socket.
  2. -n, -–numeric 直接使用IP地址, 而不通过域名服务器
  3. -p, -–programs 显示正在使用Socket的程序识别码和程序名称
  4. -t, -–tcp 显示TCP传输协议的连线状况
  5.  
  6. # 显示正打开侦听端口的程序
  7. netstat -lnp
  8. # 显示和本机端口已经建立的连接
  9. netstat -antp

  

ps 用于查看系统进程的工具

  1. #
  2. ps aux
  3.  
  4. #
  5. ps -eLf

  

使用 vmstat, mpstat 和 sar 查看系统运行参数的更多相关文章

  1. NVIDIA TX2--3--NVIDIA Jetson TX2 查看系统版本参数状态及重要指令

    NVIDIA Jetson TX2 查看系统参数状态. 当前博主的TX2更新的版本为:Jetpack 3.3, cuda 9.0.252, cudnn7.0, opencv3.3.1, TensorR ...

  2. vmstat的使用(查看系统各种负载)

    $ vmstatprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd f ...

  3. Linux查看系统运行情况

    http://elinux.org/Runtime_Memory_Measurement

  4. 电脑开机后win系统运行异常慢,鼠标移动卡

    今天公司里面一个小伙伴的电脑开机后还没有打开应用程序系统就运行非常慢,打开文件夹反应慢,鼠标是一点一点的在移动.体验感极差.作为运维的我立即上去解决问题: 首先是查看一下电脑确实运行比较慢,然后就查看 ...

  5. Linux查看系统开机和关机时间

    1.who 命令查看 who   -b    查看最后一次系统启动的时间 who   -r     查看当前系统运行时间   [root@test ~]# who -b          system ...

  6. 使用w uptime vmstat top sar nload 等命令查看系统负载

    1.  w 和uptime,查看cpu的使用率: 2.vmstat 命令,查看更细的物理设备使用状况: 3.top 命令: top -c  可具体查看命令及路径: top -bn1 静太显示一条命令, ...

  7. 使用w查看系统负载 vmstat命令 top命令 sar命令 nload命令

    w/uptime 查看系统负载 w查看系统负载,uptime跟w一样. [root@centos7 ~]# w 22:34:10 up 6 days, 23:10,  4 users,  load a ...

  8. Linux centos7 日常运维——使用w查看系统负载、vmstat命令、top命令、sar命令、nload命令

    一.使用w查看系统负载 w .uptime查看系统负载,0.00表示1分钟之内负载为0 cat  /proc/cpuinfo查看cpu核数 二.vmstat命令,查看进程.cpu.memory.交换. ...

  9. 【系统监控】性能监测 vmstat,mpstat,iostat

    一.系统整体性能监测工具:uptime [root@WebServer ~]# uptime (同w命令输出的第一行信息) 09:40:52 up 5 days, 57 min, 1 user, lo ...

随机推荐

  1. 异构平台同步(mysql-->oracle)

    https://www.cnblogs.com/andy6/p/6159060.html

  2. [转] JavaScript:彻底理解同步、异步和事件循环(Event Loop)

    一. 单线程 我们常说“JavaScript是单线程的”. 所谓单线程,是指在JS引擎中负责解释和执行JavaScript代码的线程只有一个.不妨叫它主线程. 但是实际上还存在其他的线程.例如:处理A ...

  3. Redis数据结构之字符串

    学习阶段分成两个部分,一个是redis客户端,一个是java客户端操作 一:在redis客户端操作 1.先删除里面的几个key 2.set与get与getset 3.数值的增减 值递增1,或者减一 如 ...

  4. PHP通过PDFParser解析PDF文件

    之前一直找到的资料都是教你怎么生成pdf文档,比如:TCPDF.FPDF.wkhtmltopdf.而我碰到的项目里需要验证从远程获取的pdf文件是否受损.文件内容是否一致这些问题,这些都不能直接提供给 ...

  5. 为什么NULL指针也能访问成员函数?(但不能访问成员变量)

    查看更加详细的解析请参考这篇文章:http://blog.51cto.com/9291927/2148695 看一个静态绑定的例子: 1 #include <iostream> 2 3 u ...

  6. 洛谷 P1352 没有上司的舞会【树形DP】(经典)

    <题目链接> <转载于>>> > 题目描述: 某大学有N个职员,编号为1~N.他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的 ...

  7. C#并行编程(1):理解并行

    什么是并行 并行是指两个或者多个事件在同一时刻发生. 在程序运行中,并行指多个CPU核心同时执行不同的任务:对于单核心CPU,严格来说是没有程序并行的.并行是为了提高任务执行效率,更快的获取结果. 与 ...

  8. 工作->离职->考研

    1.工作篇 去年我大三,理论上来说我应该考研,也必须考研,我当时的想法也是这样.但是不知道什么情况,我竟然选择了工作,连我也没想到的反转,可能当时我对自己的技术很自信?我想可能是,有点对自己技术觉得还 ...

  9. [漏洞分析]thinkphp 5.1.25 insert、insetAll、update方法注入

    0x00 前言 这个洞,早在9月29号的时候我提交给先知,那时候tp还是5.1.25的版本,天还很蓝,我也还很年轻.时至今日这个洞依旧没有审核,而tp在这期间都已经更新到了5.1.29.在最近我去跟踪 ...

  10. 每日踩坑 2019-04-09 Web.config configuration 蓝色波浪线 未声明 configuration 标签的解决办法

    百度看了几篇答案都没有给出解决方案,看了看 MSDN. https://docs.microsoft.com/zh-cn/previous-versions/ms228147(v=vs.110) 似乎 ...