Linux – very specific iostat output needed in realtime

centosiostatlinux

Is there anyway to get the output of iostat -m and add only the column await from the extended output in realtime? I know this question sounds nutso but I need to be able to get all those column in realtime without outputing to a file or running iostat twice since that would give misleading results. This is centos 6.2 iostat 9.0.4. kernel 2.6.36.4. So to summarize I need this.

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
sda               0.56         0.00         0.00        324        485

and I need to add await to it so it looks like this.

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn   await
sda               0.56         0.00         0.00        324        485   10.72

Am I dreaming? I'm I looking at this the wrong way? Do I need to compile my own iostat?

Thanks in advance.

Best Answer

I'm not sure how to get the iostat formatting you're looking for. The tool I use for this type of monitoring, though, is customizable to the point where you could display the relevant fields. It's also excellent for generating data for replay and graphing purposes.

I use Collectl monitoring (available in CentOS via yum), and the disk check flags should give you what you need:

collectl -sD --dskfilt sda

Sample output (you can change the units and columns printed):

collectl -sD --dskfilt sdb
waiting for 1 second sample...

# DISK STATISTICS (/sec)
#          <---------reads---------><---------writes---------><--------averages--------> Pct
#Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
sdb              0      0    0    0     336      0   52    6       6     0     0      0    1
sdb             16      0    1   16     389      1   52    7       7     0     0      0    3
sdb              0      0    0    0    1236      9  109   11      11     0     0      0    0
sdb             16      0    1   16     676      3  140    5       4     0     1      1   14
sdb              0      0    0    0      64      1   16    4       4     0     2      1    2