简介

iostat可以提供更丰富的IO性能状态数据,iostat命令有两个用途:

  • 输出CPU的统计信息
  • 输出设备和分区的I/O统计信息

命令语法及参数说明

语法:

iostat [ -c | -d ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -n ] [ -h ] [ device [ ... ] | ALL ] [ -p [ device | ALL ] ] [ interval [count ] ]

输出

参数说明:

参数 描述
-c The -c option is exclusive of the -d option and displays only the CPU usage report. 
 输出CPU统计信息。不能与-d参数同时使用。
-d The -d option is exclusive of the -c option and displays only the device utilization report. 
 输出设备和分区的I/O统计信息。不能与-c参数同时使用。
-k Display statistics in kilobytes per second instead of blocks per second.  Data displayed are valid only with kernels 2.4 and newer. 
 用“kbytes/秒”代替“块/秒”显示统计信息。在内核2.4以及新版中才有效。 
-m Display  statistics  in  megabytes  per second instead of blocks or kilobytes per second. Data displayed are valid only with kernels 2.4 and  newer. 
 用“mbytes/秒”代替“块/秒”显示统计信息。在内核2.4以及新版中才有效。 
-t Displays the NFS-directory statistic.  Data displayed are valid only with kernels 2.6.17 and  newer.   This  option  is exclusive ot the -x option. 
 显示NFS目录统计信息。在内核2.6.17以及新版中才有效。不能与参数-x同时使用。
-V Print version number then exit. 
 显示版本号并通出。 
-x Display  extended statistics.  This option is exclusive of the -p and -n, and works with post 2.5 kernels since it needs /proc/diskstats file or a mounted sysfs to get the statistics. This option may also work with older kernels  (e.g.  2.4) only if extended statistics are available in /proc/partitions (the kernel needs to be patched for that). 
 显示扩展统计信息。不能与参数-p和-n同时使用,并且需要在内核2.5以上才能使用,因为它需要/proc/diskstats 或者 加载sysfs获取统计信息。如果只是统计/proc/partitios的扩展统计信息,这个参数可能也能在老版本的内核(如:2.4)中工作(需要给内核打补丁) 
-n Displays the NFS-directory statistic.  Data displayed are valid only with kernels 2.6.17 and  newer.   This  option  is exclusive ot the -x option. 
 显示NFS目录统计信息。需要内核2.6.17或更新版本才有效。不能与参数-x同时使用。
-h Display the NFS report more human readable. 
 可读性更好的NFS目录统计信息 
-p The  -p option is exclusive of the -x option and displays statistics for block devices and all their partitions that are used by the system.  If a device name is entered on the command line, then statistics for it and all its partitions  are displayed. Last, the ALL keyword indicates that statistics have to be displayed for all the block devices and partitions defined by the system, including those that have never been used.  Note that this option works only with post  2.5  ker-nels. 
 显示系统使用的块设备和它们的分区统计信息。不能与参数-x同时使用。如果命令中指定了设备名称,显示设备和它的所有分区的统计。如果使用了关键字ALL,将显示系统所有块设备和分区统计信息,即使它们没有被使用。只有在内核2.5或更新版本中有效。 
interval 刷新时间间隔
count 刷新次数

CPU统计信息字段说明

参数 描述
%user Show the percentage of CPU utilization that occurred while executing at the user level (application). 
 用户进程使用的CPU使用率百分比。 
%nice Show the percentage of CPU utilization that occurred while executing at the user level with nice priority. 
%system Show the percentage of CPU utilization that occurred while executing at the system level (kernel). 
 系统进程使用的CPU使用率百分比。 
%iowait Show  the  percentage  of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. 
 系统输出数据至磁盘时空闲的CPU时间百分比(即IO等待)。 
%steal Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servic-ing another virtual processor. 
%idle Show  the  percentage  of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request. 
 系统没有任何数据输出至磁盘的CPU时间百分比(即空闲时间) 

设备统计信息字段说明

参数 描述
Device This column gives the device (or partition) name, which is displayed as hdiskn with  2.2  kernels,  for  the  nth device.  It  is displayed as devm-n with 2.4 kernels, where m is the major number of the device, and n a distinc-tive number.  With newer kernels, the device name as listed in the /dev directory is displayed. 
 设备或分区名称。 
tps Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request  to  the device. Multiple logical requests can be combined into a single I/O request to the device. A transfer is of inde-terminate size. 
 设备每秒的传输次数。一个IO请求表示一个传输。多个逻辑请求可以被组成一个I/O请求。一个传输的大小未知。 
Blk_read/s Indicate the amount of data read from the device expressed in a number of blocks per second. Blocks  are  equiva-lent to sectors with 2.4 kernels and newer and therefore have a size of 512 bytes. With older kernels, a block is of indeterminate size. 
 每秒从设备读取数据量(单位:数据块)。 
Blk_wrtn/s Indicate the amount of data written to the device expressed in a number of blocks per second. 
 每秒写入设备的数据量(单位:数据块)。 
Blk_read The total number of blocks read. 
 读取的总数量(单位:数据块)。 
Blk_wrtn The total number of blocks written. 
 写入的总数量(单位:数据块)。
kB_read/s Indicate the amount of data read from the device expressed in kilobytes per second. 
 每秒从设备读取的数据量(单位:KB) 
kB_wrtn/s Indicate the amount of data written to the device expressed in kilobytes per second. 
 每秒写入设备的数据量(单位:KB)
kB_read The total number of kilobytes read. 
 读取的总数量(单位:KB) 
kB_wrtn The total number of kilobytes written. 
 写入的总数量(单位:KB)。
MB_read/s Indicate the amount of data read from the device expressed in megabytes per second. 
 每秒从设备读取的数据量(单位:MB)
MB_wrtn/s Indicate the amount of data written to the device expressed in megabytes per second. 
 每秒写入设备的数据量(单位:MB)
MB_read The total number of megabytes read. 
 读取的总数量(单位:MB)
MB_wrtn The total number of megabytes written. 
 写入的总数量(单位:MB)。
rrqm/s The number of read requests merged per second that were queued to the device. 
 每秒被合并的读请求数。 
wrqm/s The number of write requests merged per second that were queued to the device. 
 每秒被合并的写请求数。 
r/s The number of read requests that were issued to the device per second. 
 每秒的读请求数。 
w/s The number of write requests that were issued to the device per second. 
 每秒的写请求数。 
rsec/s The number of sectors read from the device per second. 
 每秒读取的扇区数。 
wsec/s The number of sectors written to the device per second. 
 每秒写入的扇区数。 
rkB/s The number of kilobytes read from the device per second. 
 每秒从设备读取的数据量(单位:KB)
wkB/s The number of kilobytes written to the device per second. 
 每秒写入设备的数据量(单位:KB)
rMB/s The number of megabytes read from the device per second. 
 每秒从设备读取的数据量(单位:MB)
wMB/s The number of megabytes written to the device per second. 
每秒写入设备的数据量(单位:MB) 
avgrq-sz The average size (in sectors) of the requests that were issued to the device. 
  
avgqu-sz The average queue length of the requests that were issued to the device. 
  
await The average time (in milliseconds) for I/O requests issued to the device to be served.  This  includes  the  time spent by the requests in queue and the time spent servicing them. 
 I/O请求等待时间的平均值(单位:毫秒)。 
svctm The average service time (in milliseconds) for I/O requests that were issued to the device. 
 I/O请求处理时间的平均值(单位:毫秒)。 
%util Percentage  of  CPU  time  during  which  I/O  requests  were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%. 
 消耗在I/O请求中的CPU时间百分比(设备带宽利用率)。如果该值接近100%说明设备出现了瓶颈。

示例

1、统计CPU使用情况

[nieyong@nieyong-redhat ~]$ iostat -c 1 3 Linux 2.6.18-274.3.1.el5 (nieyong-redhat) 2013年04月13日 avg-cpu: %user %nice %system %iowait %steal %idle 0.39 0.22 0.92 2.80 0.00 95.68 avg-cpu: %user %nice %system %iowait %steal %idle 0.00 0.00 0.00 1.00 0.00 99.00 avg-cpu: %user %nice %system %iowait %steal %idle 0.00 0.00 0.00 0.00 0.00 100.00

2、统计磁盘使用情况

[nieyong@nieyong-redhat ~]$ iostat -d 1 3 Linux 2.6.18-274.3.1.el5 (nieyong-redhat) 2013年04月13日 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 6.39 124.29 27.41 1418077 312756 sda1 0.01 0.16 0.00 1826 4 sda2 6.38 123.95 27.41 1414210 312752 sda3 0.01 0.14 0.00 1617 0 hda 0.00 0.01 0.00 152 0 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 0.00 0.00 0.00 0 0 sda1 0.00 0.00 0.00 0 0 sda2 0.00 0.00 0.00 0 0 sda3 0.00 0.00 0.00 0 0 hda 0.00 0.00 0.00 0 0 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 0.00 0.00 0.00 0 0 sda1 0.00 0.00 0.00 0 0 sda2 0.00 0.00 0.00 0 0 sda3 0.00 0.00 0.00 0 0 hda 0.00 0.00 0.00 0 0

参考:
Linux - iostat命令详解 
Linux的IO性能监控工具iostat详解 

Linux - iostat命令详解的更多相关文章

  1. linux iostat命令详解 磁盘操作监控工具

    Linux系统中的 iostat是I/O statistics(输入/输出统计)的缩写,iostat工具将对系统的磁盘操作活动进行监视. 它的特点是汇报磁盘活动统计情况,同时也会汇报出CPU使用情况. ...

  2. [linux]iostat命令详解-监视系统输入输出设备和CPU的使用情况

    部分转载https://blog.csdn.net/sunansheng/article/details/51942281 iostat命令被用于监视系统输入输出设备和CPU的使用情况.它的特点是汇报 ...

  3. linux awk命令详解

    linux awk命令详解 简介 awk是一个强大的文本分析工具,相对于grep的查找,sed的编辑,awk在其对数据分析并生成报告时,显得尤为强大.简单来说awk就是把文件逐行的读入,以空格为默认分 ...

  4. linux cat 命令详解

    linux cat 命令详解 http://linux.chinaunix.net/techdoc/system/2007/11/16/972467.shtml adb shell su //这个不一 ...

  5. 【初级】linux rm 命令详解及使用方法实战

    rm:删除命令 前言: windows中的删除命令大家都不陌生,linux中的删除命令和windows中有一个共同特点,那就是危险,前两篇linux mkdir 命令详解及使用方法实战[初级]中我们就 ...

  6. Linux netstat命令详解

    Linux netstat命令详解 一  简介 Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多 ...

  7. linux grep命令详解

    linux grep命令详解 简介 grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来 ...

  8. Linux chmod命令详解

    Linux chmod命令详解 chmod----改变一个或多个文件的存取模式(mode)   chmod [options] mode files   只能文件属主或特权用户才能使用该功能来改变文件 ...

  9. 【转发】linux yum命令详解

    linux yum命令详解 yum(全 称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理, ...

随机推荐

  1. Not supported by Zabbix Agent & zabbix agent重装

    zabbix服务器显示一些监控项不起效,提示错误[Not supported by Zabbix Agent], 最后定位为zabbix客户端版本过低. Not supported by Zabbix ...

  2. VR问题无关方向,VR全景为您领航,全景智慧城市已势不可当

    2016年,VR绝对是互联网科技圈的一个高频词. 在这一年里,Magic Leap获得阿里领投的近8亿美元的融资,VR公司的商业价值得到认可.Oculus Rift和HTC Vive的VR产品正式发货 ...

  3. enote笔记语言(2)(ver0.3)

    why not(whyn't)                      为什么不(与“why”相对应,是它的反面)   how对策 how设计   key-memo:                 ...

  4. Win95+IE3 – Win10+IE11全版本执行漏洞(含POC)

    微软本月安全更新修复了一个潜藏了18年的IE远程代码执行漏洞(CVE-2014-6332),可以说是给windows吃了一颗大补丸.缺陷出现在VBScript的代码中,自Windows 95首次发布( ...

  5. java mvc框架系列总结ssh,ssm,servlet

    2016年10月3日 10:36:40 一直以来都很想写属于自己的博客,一来可以分享自己的学习经验,二来可以及时总结,毕竟博客是写给所有人看的,需要更加仔细的注意每个细节,而不是仅仅让自己看懂. 学了 ...

  6. AngularJS语法基础及数据绑定——详解各种数据绑定指令、属性应用

    AngularJS简单易学,但是功能强大.特别是在构建单页面应用方面效果显著.而 数据绑定 可以说是他被广泛使用的最主要的优点.他舍弃了对DOM的操作方式,一切都由AngularJS来自动更新视图,我 ...

  7. 使用Eclipse进行Javaweb项目开发时,如何设置外置浏览器Chrome

    使用Eclipse开发Javaweb项目时,在Eclipse中显示页面不是很好,那么如何让它自动打开外置浏览器呢?操作如下

  8. 腾讯AlloyTeam发布AlloyLever - 开发调试发布错误监控上报用户问题定位尽在1kb代码

    AlloyLever [官网][Giuhub] 1kb(gzip)代码搞定开发调试发布,错误监控上报,用户问题定位. 支持错误监控和上报 支持 vConsole错误展示 支持开发阶段使用 vConso ...

  9. 逆向libbaiduprotect(四)

    百度加固libbaiduprotect.so自身对只读字符串进行了加密保护,防止成为破解和逆向的切入口.一般地认为,只要找出这个解密算法就可以对.rodata段的只读字符串进行破解,从而窥探程序的意图 ...

  10. top的用法

    top命令可以用来方便地观察当前系统中运行的进程的信息,并可以在运行过程中执行改变进程的优先级.更改排序规则.导出状态信息等操作,非常方便. 1.主要选项 -d:后接秒数,状态更新的秒数,默认5秒-b ...