 |
lists.netmrg.net NetMRG discussion and support
|
|
|
| Author |
Message |
rmet0815 Helper
Joined: 18 Mar 2004 Posts: 20
|
Posted: Thu Mar 18, 2004 8:34 pm Post subject: graphs for disk IO |
|
|
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 :)
Cheeio
/rudy |
|
| Back to top |
|
 |
balleman Site Admin
Joined: 20 Jan 2003 Posts: 282
|
Posted: Sat Mar 20, 2004 6:17 pm Post subject: |
|
|
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.
| Code: |
#!/usr/bin/perl
#
# linuxinterrupts.pl
#
# 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";
exit(1);
} # 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];
}
else
{
print $fields[7];
}
print "\n";
exit(0);
} # end if found percent left
} # end if percent left to check
close 'iofh';
print "U\n";
exit (1);
|
I named this file linuxpartitions.pl and placed it in NetMRG's libexec directory. I then added two new Script tests in NetMRG:
Linux Disk I/O (Read)
linuxpartitions.pl %dskDevice% -r
Linux Disk I/O (Write)
linuxpartitions.pl %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. |
|
| Back to top |
|
 |
rmet0815 Helper
Joined: 18 Mar 2004 Posts: 20
|
Posted: Mon Mar 22, 2004 12:39 pm Post subject: |
|
|
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!
/rudy |
|
| Back to top |
|
 |
balleman Site Admin
Joined: 20 Jan 2003 Posts: 282
|
Posted: Mon Mar 22, 2004 1:33 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
rmet0815 Helper
Joined: 18 Mar 2004 Posts: 20
|
Posted: Tue Mar 23, 2004 10:02 am Post subject: |
|
|
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 linuxpartitions.pl 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/linuxpartitions.pl %dskDevice% -w
Linux Disk I/O (read remote)
/usr/bin/ssh -x %ip% /usr/libexec/netmrg/linuxpartitions.pl %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! :)
Cheerio
/rudy |
|
| Back to top |
|
 |
|
smartBlue Style © 2002 Smartor
Powered by phpBB © 2001, 2002 phpBB Group
|