graphs for disk IO


18-03-2004 15:34:15

It would be cool if there are graphs for disk IO (for Linux). I was looking around on the SNMP MIBs and found one which can provide these settings (UCD-DISKIO-MIB), but I am unfortunately to unexperienced in SNMP to access these values (

So if anyone more exprienced would add a new default template to netmrg, alot of DB admins would be happy )



20-03-2004 13:17:47

I looked at UCD-DISKIO-MIB awhile back, but from what I could tell, isn't compiled into Fedora/RedHat binary releases. I'm not sure if it was abandoned, still under development, or just on a RedHat blacklist.

Not wanting to compile my own net-snmp if I could avoid it, I just wrote a script (well, modified another one) to parse the /proc/partitions data under Linux. With some tweaking, you can probably get what you need with this.

# reports partition I/O counters

use strict;

if (scalar(@ARGV) != 2)
print "U\n";
print "\n";
print "$0 <partition | disk> <-r|-w>\n";
print "\n";
} # end if not enough parameters

# read in info from apm
open 'iofh', "/proc/partitions";

## get the value we want
my $line = "";
my $partition = $ARGV[0];
while ($line = <iofh>)
if ($line =~ / $partition /)
my @fields = split(/\s+/, $line);
if ($ARGV[1] eq "-w")
print $fields[11];
print $fields[7];
print "\n";
} # end if found percent left
} # end if percent left to check
close 'iofh';

print "U\n";
exit (1);

I named this file and placed it in NetMRG's libexec directory. I then added two new Script tests in NetMRG

Linux Disk I/O (Read) %dskDevice% -r

Linux Disk I/O (Write) %dskDevice% -w

One major drawback to this is that, being a script test, it only works for the box that does the polling.

Well, I hope this helps a bit. Let us know if you find a better way of getting these stats. Also, if anyone knows the fate of the UCD-DISKIO-MIB, we'd be grateful for hearing about it.


22-03-2004 07:39:34

Thanx alot for this script! It does really make thiings easier.

Only problems are the one you already stated (only runs on "local" machine), and it also cannot check diskIO in software raid and lvm (can linux 2.4 do that anyway???).

Too bad the snmp solution does not work out (yet). But maybe it comes with FC2 )

Thanx again!


22-03-2004 08:33:15

Yeah, on my server box I'm graphing the partitions that are below my LVM and RAID stuff. Probably not ideal in all situations, but I don't mind seeing which physical drive is being used.


23-03-2004 05:02:20

If anyone is interested in monitoring disk IO of remote machines, I came up with the following solution using SSH. It works the same as described above, except that you have to use SSH to log into the remote system.

You first have to create a key for your local system (ssh-keygen -t dsa/rsa) and then add your public key into the authorized_key file of the remote host (mind the file permissions!). This you have to do for the user who is executing the cronjob (netmrg-gatherer!). I am using netmrg for that, so I also had to create this uer on the remote host (homedir /usr/libexec/netmrg).

Then copy over the to the remote host (I put them into /usr/libexec/netmrg, same as on the original). Executable by netmrg (or however you want it, just make sure that the ssh user can execute them).

Then add the following to your scripts

Linux Disk I/O (write remote)
/usr/bin/ssh -x %ip% /usr/libexec/netmrg/ %dskDevice% -w

Linux Disk I/O (read remote)
/usr/bin/ssh -x %ip% /usr/libexec/netmrg/ %dskDevice% -r

These scripts will log into the remote machine (via ssh using the key-file)

You can then set up your graphs however you want (I created a template monitor and a template graph, then added the montiors to the Disk section of the host and also added the template monitor there [clicking on the 'gray' item in the device tree, next to the disk(partition)]).

It works wonderful and again proves how nice a tool this netmrg is! )