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.
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:
Sample output (you can change the units and columns printed):
This seems like something that should be monitorable with munin, graphite, etc.
EDIT: If your system has
watch
, you can set the iostat to automatically run a given (or infinitely-reapeating) number of times, with a specified gap between runs!awk
out the fields that you actually want!Why not creating a wrapper in bash ?
One-liner version would look like :
This will run iostat twice, and return the right value of await (which is 7th column)
You can do the same with vmstat by passing the right column to awk to get whole CPU iowait. For example :
Note that iostat and vmstat is different on each linux distribution and you have to pick the right column.
rereading the original question if the author is looking for real-time info, I agree collectl is the way to go. that's why I wrote it. ;)
if there is some specific thing you're trying to do with the data perhaps I could help but I'd need to know more. as for how real-time you want to be, you can choose any sub-second monitoring interval you like.
-mark