I recently installed mon on some opensuse 10.3 machines, but could not 
get the snmpdiskspace.monitor to work. I am not a perl guy, but it 
seems the information coming back from the perl Net::SNMP module is 
not correct, in that it assumes all fields are contiguous when they 
are not. Eg, if I run snmpwalk, I get the following:

# snmpwalk -c public -v 1 -OqUes server hrStorage

...

hrStorageType.1 hrStorageRam
hrStorageType.3 hrStorageVirtualMemory
hrStorageType.6 hrStorageOther
hrStorageType.7 hrStorageOther
hrStorageType.8 hrStorageOther
hrStorageType.10 hrStorageVirtualMemory
hrStorageType.31 hrStorageFixedDisk
hrStorageType.32 hrStorageFixedDisk
hrStorageType.33 hrStorageFixedDisk
hrStorageType.34 hrStorageFixedDisk
hrStorageType.35 hrStorageFixedDisk
hrStorageType.36 hrStorageFixedDisk

...

hrStorageSize.1 3285532
hrStorageSize.3 7494540
hrStorageSize.6 84
hrStorageSize.7 2266336
hrStorageSize.8 0
hrStorageSize.10 4209008
hrStorageSize.31 2581426
hrStorageSize.32 0
hrStorageSize.33 0
hrStorageSize.34 497765
hrStorageSize.35 179832960
hrStorageSize.36 11795894

...

hrStorageUsed.1 3264448
hrStorageUsed.3 3269336
hrStorageUsed.10 4888
hrStorageUsed.31 625653
hrStorageUsed.32 0
hrStorageUsed.33 0
hrStorageUsed.34 14543
hrStorageUsed.35 106627635
hrStorageUsed.36 8248903

Note that thee hrStorageUsed entries are not in 1-1 coresspondence 
with the hrStorageSize entries. I believe Net::SNMP assumes they are 
(or maybe snmpdiskspace.monitor does), and hences assumes, for 
example, that hrStorageSize.6 is associated with hrStorageUsed.10, 
which leads to erroneous results. 

Anyway, I wrote a quick and dirty bash version of snmpdiskspace, which 
cotrrectly parses the output of snmpwalk. It is very basic but can be 
easily extended: there's no config file and it only looks at fixed 
disks (hrStorageType == hrStorageFixedDisk). You can specify the 
percent free threshold and snmp community on the commandline. 

I've attached the monitor in case others find it useful. 

Regards,

Jonathan Baxter



Attachment: snmpfreespace.monitor
Description: application/shellscript

_______________________________________________
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to