[mrtg] iostat for disk io?
Trever Furnish
trever at wowemployers.com
Wed Apr 4 19:39:13 MEST 2001
Ok, this is really more of an iostat question, but perhaps you folks have
better ways...?
I wrote a little shell script to pull disk io stats into mrtg by parsing the
output of the iostat command on linux. Everything works fine with mrtg.
But, although mrtg produces the numbers I expect, iostat seems to be in
conflict with itself.
For example, iostat tells mrtg that 5936 blocks were written in the last 5
minutes. MRTG properly graphs this as an average of 19 or so blocks per
second. However, iostat's column for blocks written per second says it was
9.89 blocks per second.
The script I'm using is below. Below that is sample output from iostat.
I'm checking iostat's idea of the 5-minute average by running iostat -d 300
continuously and comparing it to the mrtg graph. Did I screw up my math
here? Is there some better way to pull this info?
--
Trever
--------------------------------------------------
Script: mrtg-diskio.sh
======================
#!/bin/bash
hostname=`hostname`
uptime=`uptime | awk '{print $3}'`
uptime="$uptime days"
# default to hdisk0's line.
tag=${1:-hdisk0}
blck_in=`iostat -d | grep $tag | awk '{ print $5 }'`
blck_out=`iostat -d | grep $tag | awk '{ print $6 }'`
echo $blck_in
echo $blck_out
echo $uptime
echo $hostname
--------------------------------------------------
Sample iostat -d 300 output
===========================
iostat -d 300
Linux 2.2.16-22enterprise (mail1.wowemployers.com) 04/04/2001
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.37 1.03 9.37 1095078 10373212
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 0.00 0.00 0.00 0 7584
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.26 0.00 10.09 0 6056
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.32 0.00 10.62 0 6376
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.37 0.00 11.01 0 6608
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.27 0.00 10.16 0 6096
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.56 0.00 12.52 0 7512
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.29 0.00 10.34 0 6208
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.23 0.00 9.89 0 5936
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.21 0.00 9.72 0 5832
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
Disks: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
hdisk0 1.38 0.00 11.04 0 6624
hdisk1 0.00 0.00 0.00 0 0
hdisk2 0.00 0.00 0.00 0 0
hdisk3 0.00 0.00 0.00 0 0
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list