iostat:I/O信息统计

xiaohai 2021-07-24 16:43:16 1683人围观 标签: Linux 
简介 iostat是I/O statistics的缩写,起主要功能是对系统的磁盘I/O操作进行监控。他的输出主要是显示磁盘的读写操作的统计信息,同时也会给出CPU的使用情况。iostat命令也只能对系统的整体情况进行分析,不能对某个进程进行分析。
说明

  iostat是I/O statistics的缩写,起主要功能是对系统的磁盘I/O操作进行监控。他的输出主要是显示磁盘的读写操作的统计信息,同时也会给出CPU的使用情况。iostat命令也只能对系统的整体情况进行分析,不能对某个进程进行分析。

格式

  iostat [option] [delay时间间隔 [count次数]]

常用参数
  • -c:显示CPU的使用情况
  • -d:显示磁盘的使用情况
  • -k:以KB为单位显示数据
  • -m:以MB为单位显示数据
示例

1、显示所有设备的负载情况

[root@localhost ~]# iostat #不加时间间隔和显示次数,那么显示一次就退出
Linux 3.10.0-123.9.3.el7.x86_64 (localhost.localdomain)     06/24/2018     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.26    0.00    0.44    0.09    0.00   99.21

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               0.60        14.36        11.15     790293     613697
scd0              0.00         0.00         0.00         48          0
dm-0              0.41         0.11         1.52       5804      83780
dm-1              0.54        14.16         9.59     778804     527856

[root@localhost ~]# iostat 3 2 #间隔3秒,统计2次
Linux 3.10.0-123.9.3.el7.x86_64 (localhost.localdomain)     06/24/2018     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.27    0.00    0.44    0.09    0.00   99.21

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               0.60        14.28        11.08     790845     613971
scd0              0.00         0.00         0.00         48          0
dm-0              0.40         0.10         1.51       5804      83780
dm-1              0.54        14.07         9.53     779356     528130

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.34    0.00    0.68    0.00    0.00   98.98

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               0.00         0.00         0.00          0          0
scd0              0.00         0.00         0.00          0          0
dm-0              0.00         0.00         0.00          0          0
dm-1              0.00         0.00         0.00          0          0

2、只统计CPU信息

[root@localhost ~]# iostat -c
Linux 3.10.0-123.9.3.el7.x86_64 (localhost.localdomain)     06/24/2018     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.27    0.00    0.44    0.09    0.00   99.21

3、只统计磁盘信息

[root@localhost ~]# iostat -d
Linux 3.10.0-123.9.3.el7.x86_64 (localhost.localdomain)     06/24/2018     _x86_64_    (1 CPU)

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               0.60        14.29        11.09     790845     613953
scd0              0.00         0.00         0.00         48          0
dm-0              0.40         0.10         1.51       5804      83780
dm-1              0.54        14.08         9.54     779356     528112