iostat (iostat命令报告CPU和I/O使用情况统计信息)

瑞兹 发表于 2021-01-26 09:10
浏览次数:
在手机上阅读

在类似Unix的操作系统上,iostat命令报告CPU和I/O使用情况统计信息。

查看英文版

目录

1 iostat 运行系统环境

2 iostat 描述

3 iostat 语法

4 iostat 例子

iostat 运行系统环境

Unix&Linux

iostat 描述

所述的iostat命令用于通过观察时间的装置在相对于它们的平均传输速率监测活性系统的输入/输出设备负载。所述的iostat命令生成可用于改变系统报告配置,以更好地平衡物理之间的输入/输出负荷的磁盘。

iostat命令生成的第一个报告提供有关自系统启动以来的时间的统计信息。每个后续报告涵盖自上一个报告以来的时间。每次运行iostat命令时,都会报告所有统计信息。该报告由一个CPU标头行和随后的CPU统计信息行组成。在多处理器系统上,CPU统计信息是系统范围内所有处理器的平均值。将显示设备标题行,后跟配置的每个设备的一行统计信息。

interval参数指定每个报告之间的时间间隔(以秒为单位)。第一个报告包含自系统启动(引导)以来的时间统计信息。每个后续报告均包含自上次报告以来的时间间隔内收集的统计信息。所述计数参数可以与结合指定间隔参数。如果指定了count参数,count的值将确定间隔间隔秒生成的报告数。如果间隔没有被指定的参数计数参数,所述的iostat命令连续地生成报告。

The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks.

The first report generated by the iostat command provides statistics concerning the time since the system was booted. Each subsequent report covers the time since the previous report. All statistics are reported each time the iostat command is run. The report consists of a CPU header row followed by a row of CPU statistics. On multiprocessor systems, CPU statistics are calculated system-wide as averages among all processors. A device header row is displayed followed by a line of statistics for each device that is configured.

The interval parameter specifies the amount of time in seconds between each report. The first report contains statistics for the time since system startup (boot). Each subsequent report contains statistics collected during the interval since the previous report. The count parameter can be specified in conjunction with the interval parameter. If the count parameter is specified, the value of count determines the number of reports generated at interval seconds apart. If the interval parameter is specified without the count parameter, the iostat command generates reports continuously.

查看英文版

查看中文版

iostat 语法

iostat [ -c ] [ -d ] [ -h ] [ -N ] [ -k | -m ] [ -t ] [ -V ] [ -x ]
       [ -z ] [ [ [ -T ] -g group_name ] { device [...] | ALL } ]
       [ -p [ device [,...] | ALL ] ] [ interval [ count ] ]

报告书

iostat的命令生成三种类型的报告:CPU使用率报告,该设备利用率报告和网络文件系统的报告。

CPU使用率报告

iostat命令生成的第一个报告是CPU利用率报告。对于多处理器系统,CPU值是所有处理器之间的全局平均值。该报告具有以下格式:

%user

显示在用户(应用程序)级别执行时发生的CPU利用率百分比。

%nice

显示具有良好 优先级的用户级别执行时发生的CPU利用率百分比。

%system

显示在系统(内核)级别执行时发生的CPU利用率百分比。

%iowait

显示在系统有未完成的磁盘I / O请求期间,一个或多个CPU空闲的时间百分比。

%steal

显示在管理程序为另一个虚拟处理器提供服务时,一个或多个虚拟CPU在非自愿等待中花费的时间百分比。

%idle

显示一个或多个CPU空闲且系统没有未完成的磁盘I / O请求的时间百分比。

设备使用率报告

iostat命令生成的第二个报告是“设备使用率报告”。设备报告提供了基于每个物理设备或分区的统计信息。可以在命令行上输入要显示其统计信息的块设备和分区。如果未输入设备或分区,则将显示系统使用的每个设备的统计信息,前提是内核需要为其维护统计信息。

如果在命令行上指定了ALL 关键字,则将显示系统定义的每个设备的统计信息,包括从未使用过的设备。除非设置了环境变量 POSIXLY_CORRECT,否则默认情况下传输速率以1K块为单位,在这种情况下,将使用512字节的块。该报告可能显示以下字段,具体取决于所使用的标志:

Device

此列提供/ dev目录中列出的设备(或分区)名称。

tps

指示每秒发送到设备的传输次数。传输是对设备的I / O请求。多个逻辑请求可以组合成对设备的单个I / O请求。传输的大小不确定。

Blk_read / s(kB_read / s,MB_read / s)

表示从设备读取的数据量,以每秒的块数(千字节,兆字节)表示。块等同于扇区,因此大小为512字节。

Blk_wrtn / s(kB_wrtn / s,MB_wrtn / s)

指示写入设备的数据量,以每秒的块数(千字节,兆字节)表示。

Blk_read(kB_read,MB_read)

读取的总块数(千字节,兆字节)。

Blk_wrtn(kB_wrtn,MB_wrtn)

写入的总块数(千字节,兆字节)。

rrqm /s

每秒排队到设备中的读取请求的数量。

wrqm /s

每秒排队到设备中的合并写入请求的数量。

r /s

每秒设备完成的读取请求数(合并后)。

w / s

每秒设备完成的写请求数(合并后)。

rsec / s(rkB / s,rMB / s)

每秒从设备读取的扇区数(千字节,兆字节)。

wsec / s(wkB / s,wMB / s)

每秒写入设备的扇区数(千字节,兆字节)。

avgrq-sz

发出到设备的请求的平均大小(以扇区为单位)。

avgqu-sz

发出到设备的请求的平均队列长度。

r_await

发出给要服务的设备的I / O请求的平均时间(以毫秒为单位)。这包括队列中的请求所花费的时间以及为请求服务所花费的时间。

r_await

发送给要服务的设备的读取请求的平均时间(以毫秒为单位)。这包括队列中的请求所花费的时间以及为请求服务所花费的时间。

w_await

发出要服务的设备的写请求的平均时间(以毫秒为单位)。这包括队列中的请求所花费的时间以及为请求服务所花费的时间。

svctm

发出给设备的I / O请求的平均服务时间(以毫秒为单位)。警告!不再相信这个领域!将来的sysstat版本中将删除此字段。

%util

向设备发出I / O请求的CPU时间百分比(设备的带宽利用率)。当该值接近100%时,发生器件饱和。

选件

-C

显示CPU利用率报告。

-d

显示设备利用率报告。

-g group_name {device[...] | ALL}

显示一组设备的统计信息。所述的iostat为列表中的每个设备命令报告统计,然后该组全局统计的线显示为组名由列表中的所有设备的向上。

ALL关键字意味着,所有由系统定义块装置应被包括在组中。

-H

使设备使用情况报告更易于人阅读。(那是你!)

-k

显示统计信息(以千字节/秒为单位)。

-m

显示统计信息,以每秒兆字节为单位。

-N

显示任何设备映射器设备的注册设备映射器名称。用于查看LVM2统计信息。

-p [{devicce ...] | ALL}]

-p选项显示的统计数据块设备和由该系统所使用的所有的分区。如果在命令行上输入了设备名称,则将显示该设备及其所有分区的统计信息。

ALL关键字表示统计必须显示对于所有的块设备和分区由系统定义的,包括那些从未使用过。

-T

此选项必须与选项-g一起使用,并指示仅显示该组的全局统计信息,而不显示该组中各个设备的统计信息。

-t

打印显示的每个报告的时间。时间戳格式可能取决于S_TIME_FORMAT环境变量的值(请参见下文)。

-V

打印版本号并退出。

-X

显示扩展统计信息。

-z

告诉iostat忽略在采样期间没有任何活动的任何设备的输出。

环境

iostat的命令考虑到了以下环境变量:

S_TIME_FORMAT

如果此变量存在且其值为ISO,则在报表标题中打印日期时,将忽略当前语言环境。该iostat的命令将使用ISO 8601格式(YYYY MM DD)来代替。选项-t所显示的时间戳也将符合ISO 8601格式。

POSIXLY_CORRECT

设置此变量后,传输速率将以512-K块而不是默认的1K块显示。

iostat [ -c ] [ -d ] [ -h ] [ -N ] [ -k | -m ] [ -t ] [ -V ] [ -x ]
       [ -z ] [ [ [ -T ] -g group_name ] { device [...] | ALL } ]
       [ -p [ device [,...] | ALL ] ] [ interval [ count ] ]

Reports

The iostat command generates three types of reports: the CPU Utilization report, the Device Utilization report and the Network Filesystem report.

CPU Utilization Report

The first report generated by the iostat command is the CPU Utilization Report. For multiprocessor systems, the CPU values are global averages among all processors. The report has the following format:

%user

Show the percentage of CPU utilization that occurred while executing at the user (application) level.

%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 (kernel) level.

%iowait

Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.

%steal

Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing 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.

Device Utilization Report

The second report generated by the iostat command is the Device Utilization Report. The device report provides statistics on a per-physical device or partition basis. Block devices and partitions for which statistics are to be displayed may be entered on the command line. If no device nor partition is entered, then statistics are displayed for every device used by the system, providing that the kernel maintains statistics for it.

If the ALL keyword is given on the command line, then statistics are displayed for every device defined by the system, including those that have never been used. Transfer rates are shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used. The report may show the following fields, depending on the flags used:

Device

This column gives the device (or partition) name as listed in the /dev directory.

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 indeterminate size.

Blk_read/s (kB_read/s, MB_read/s)

Indicate the amount of data read from the device expressed in a number of blocks (kilobytesmegabytes) per second. Blocks are equivalent to sectors and therefore have a size of 512 bytes.

Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s)

Indicate the amount of data written to the device expressed in a number of blocks (kilobytes, megabytes) per second.

Blk_read (kB_read, MB_read)

The total number of blocks (kilobytes, megabytes) read.

Blk_wrtn (kB_wrtn, MB_wrtn)

The total number of blocks (kilobytes, megabytes) written.

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 (after merges) of read requests completed per second for the device.

w/s

The number (after merges) of write requests completed per second for the device.

rsec/s (rkB/s, rMB/s)

The number of sectors (kilobytes, megabytes) read from the device per second.

wsec/s (wkB/s, wMB/s)

The number of sectors (kilobytes, megabytes) written to the device per second.

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.

r_await

The average time (in milliseconds) for read requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.

w_await

The average time (in milliseconds) for write requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.

svctm

The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field anymore! This field will be removed in a future sysstat version.

%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%.

Options

-c

Display the CPU utilization report.

-d

Display the device utilization report.

-g group_name { device [...] | ALL }

Display statistics for a group of devices. The iostat command reports statistics for each device in the list, then a line of global statistics for the group displayed as group_name made up of all the devices in the list.

The ALL keyword means that all the block devices defined by the system shall be included in the group.

-h

Make the Device Utilization Report easier to read by a human. (That's you!)

-k

Display statistics in kilobytes per second.

-m

Display statistics in megabytes per second.

-N

Display the registered device mapper names for any device mapper devices. Useful for viewing LVM2 statistics.

-p [ { device [,...] | ALL } ]

The -p option 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.

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.

-T

This option must be used with option -g and indicates that only global statistics for the group are to be displayed, and not statistics for individual devices in the group.

-t

Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below).

-V

Print version number and exit.

-x

Display extended statistics.

-z

Tell iostat to omit output for any devices for which there was no activity during the sample period.

Environment

The iostat command takes into account the following environment variables:

S_TIME_FORMAT

If this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. The iostat command will use the ISO 8601 format (YYYY-MM-DD) instead. The timestamp displayed with option -t will be also be compliant with ISO 8601 format.

POSIXLY_CORRECT

When this variable is set, transfer rates are displayed in 512-K blocks instead of the default 1K blocks.

查看英文版

查看中文版

iostat 例子

iostat

显示所有CPU和设备的单个“自启动以来的历史记录”报告。

iostat -d 2

每两秒显示一次连续的设备报告。

iostat -d 2 6

对于所有设备,每两秒钟显示六个报告。

iostat -x sda sdb 2 6

对于设备sdasdb,以两秒钟的间隔显示六个扩展报告。

iostat -p sda 2 6

显示在用于设备两秒的时间间隔的六个报告SDA和设备的所有分区SDASDA1SDA2,等等)。

iostat

Display a single history-since-boot report for all CPU and Devices.

iostat -d 2

Display a continuous device report at two-second intervals.

iostat -d 2 6

Display, for all devices, six reports at two-second intervals.

iostat -x sda sdb 2 6

Display, for devices sda and sdb, six extended reports at two-second intervals.

iostat -p sda 2 6

Display six reports at two-second intervals for device sda and all the partitions of device sda (sda1sda2, etc.).

查看英文版

查看中文版

其他命令行

info | isalist | iwconfig | ifup | id | insmod |

如此好文,分享给朋友
发表评论
验证码:
评论列表
共0条