Linux下我们可以使用 sar(1), pidstat(1), mpstat(1), vmstat(8) 来监控I/O状态
一、安装
yum install sysstat
二、参数解释
FILES
/proc/stat contains system statistics.
/proc/uptime contains system uptime.
/proc/partitions contains disk statistics (for pre 2.5 kernels that have been patched).
/proc/diskstats contains disks statistics (for post 2.5 kernels).
/sys contains statistics for block devices (post 2.5 kernels).
/proc/self/mountstats contains statistics for network filesystems.
/dev/disk contains persistent device names.
CPU Utilization Report
%user Show the percentage of CPU utilization that occurred while executing at the user level (applica-tion).
%nice Show the percentage of CPU utilization that occurred while executing at the user level with nicepriority.
%system Show the percentage of CPU utilization that occurred while executing at the system level (kernel).
%iowait Show the percentage of time that the CPU or CPUs were idle during which the system had an outstand-ing disk I/O request.
%steal Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervi-sor 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 outstand-ing disk I/O request.
Device Utilization Report
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 Indicate the amount of data read from the device expressed in a number of blocks per second. Blocks
are equivalent to sectors with kernels 2.4 and later 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_wrtn/s Indicate the amount of data written to the device expressed in kilobytes per second.
kB_read The total number of kilobytes read.
kB_wrtn The total number of kilobytes written.
MB_read/s Indicate the amount of data read from the device expressed in megabytes per second.
MB_wrtn/s Indicate the amount of data written to the device expressed in megabytes per second.
MB_read The total number of megabytes read.
MB_wrtn The total number of 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 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.
wkB/s The number of kilobytes written to the device per second.
rMB/s The number of megabytes read from the device per second.
wMB/s The number of 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.
svctm The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more. 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%.
Network Filesystem report
rBlk_nor/s Indicate the number of blocks read by applications via the read(2) system call interface. A block has a size of 512 bytes.
wBlk_nor/s Indicate the number of blocks written by applications via the write(2) system call interface.
rBlk_dir/s Indicate the number of blocks read from files opened with the O_DIRECT flag.
wBlk_dir/s Indicate the number of blocks written to files opened with the O_DIRECT flag.
rBlk_svr/s Indicate the number of blocks read from the server by the NFS client via an NFS READ request.
wBlk_svr/s Indicate the number of blocks written to the server by the NFS client via an NFS WRITE request.
rkB_nor/s Indicate the number of kilobytes read by applications via the read(2) system call interface.
wkB_nor/s Indicate the number of kilobytes written by applications via the write(2) system call interface.
rkB_dir/s Indicate the number of kilobytes read from files opened with the O_DIRECT flag.
wkB_dir/s Indicate the number of kilobytes written to files opened with the O_DIRECT flag.
rkB_svr/s Indicate the number of kilobytes read from the server by the NFS client via an NFS READ request.
wkB_svr/s Indicate the number of kilobytes written to the server by the NFS client via an NFS WRITE request.
rMB_nor/s Indicate the number of megabytes read by applications via the read(2) system call interface.
wMB_nor/s Indicate the number of megabytes written by applications via the write(2) system call interface.
rMB_dir/s Indicate the number of megabytes read from files opened with the O_DIRECT flag.
wMB_dir/s Indicate the number of megabytes written to files opened with the O_DIRECT flag.
rMB_svr/s Indicate the number of megabytes read from the server by the NFS client via an NFS READ request.
wMB_svr/s Indicate the number of megabytes written to the server by the NFS client via an NFS WRITE request.
ops/s Indicate the number of operations that were issued to the filesystem per second.
rops/s Indicate the number of ’read’ operations that were issued to the filesystem per second.
wops/s Indicate the number of ’write’ operations that were issued to the filesystem per second.
命令参数
-C 显示CPU使用情况
-d 显示磁盘使用情况
-k 以 KB 为单位显示
-m 以 M 为单位显示
-N 显示磁盘阵列(LVM) 信息
-n 显示NFS 使用情况
-p[磁盘] 显示磁盘和分区的情况
-t 显示终端和CPU的信息
-x 显示详细信息
-V 显示版本信息
三、使用方式
Device Utilization Report
[root@localhost ~]# iostat -d -k 2 4
Linux 2.6.32-431.11.2.el6.x86_64 (localhost) 01/08/2016 _x86_64_ (4 CPU)
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 114.22 13.80 713.21 372234513 19241775188
xvdb 19.26 21.24 144.25 573067009 3891812336
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn