I have accomplished this by using Mr. Shipway's cfgmaker template
'generic-host.htp'. That has given me the OIDs of basically everything I need
for vital system resources...even for my network printer! I would highly
recommend that method for anyone that doesn't know much about OIDs/SNMP/MIBs or
anyone that is getting errors with SNMP strings and would like to go straight
to the OIDs.
----- Original Message -----
From: "Steve Shipway" <[email protected]>
To: "mrtg" <[email protected]>
Sent: Sunday, September 27, 2009 4:36:09 PM GMT -06:00 US/Canada Central
Subject: [mrtg] FW: Monitoring Load
Three ways to do the same thing, with 3 solutions! (1) is if the problem is the
string conversion, (2) is for if the problem is the MIB symbolic name, and (3)
is if the problem is it not being an integer. To be honest though I think (2)
or possible (2)+(3) is the way to go, but I had to include (1) as it is so
pretty J
1. Your device is outputting the laLoad variable as a string rather than as an
integer. You may need to set up a Conversion Code definition with the
fromstring() function to convert it to a real number.
In the cfg file, put a line:
ConversionCode: /usr/local/mrtg/etc/conversoincode.pl
(you might need to put a different path for your script, of course). Then, in
the conversioncode.pl file, put the text:
sub fromstring() {my $v = shift; if($v =~ /(\d+\.?\d*)/) { return $1; } else {
return 0; } }
Finally, your Target definition should add ‘|fromstring’
Target[server.wherever_load]:
laLoad.3&laLoad.3:[email protected]|fromstring
Having said all of this, though, I would have expected Perl to Do The Right
Thing when confronted with a string containing just a number. I don’t see why
this bit should be necessary.
2. Another possibility is that MRTG simply doesn’t know about the symbolic
laLoad name whereas snmpwalk does. In this case you’ll need ot tell MRTG about
the MIB.
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
3. A third possibility is to try using laLoadInt instead. This is definitely a
number, but multipled by 100. You need to divide it in the Target definition:
Target[server.wherever_load]: laLoadInt.3&laLoadInt.3:[email protected] /
100
Note that the spaces are significant in this definition.
Steve
From: [email protected] [mailto:[email protected]] On
Behalf Of Matt Baer
Sent: Monday, 28 September 2009 6:21 a.m.
To: mrtg
Subject: Re: [mrtg] Monitoring Load
Direct copy and paste output of that command:
UCD-SNMP-MIB::laIndex.1 = INTEGER: 1
UCD-SNMP-MIB::laIndex.2 = INTEGER: 2
UCD-SNMP-MIB::laIndex.3 = INTEGER: 3
UCD-SNMP-MIB::laNames.1 = STRING: Load-1
UCD-SNMP-MIB::laNames.2 = STRING: Load-5
UCD-SNMP-MIB::laNames.3 = STRING: Load-15
UCD-SNMP-MIB::laLoad.1 = STRING: 0.57
UCD-SNMP-MIB::laLoad.2 = STRING: 0.42
UCD-SNMP-MIB::laLoad.3 = STRING: 0.36
UCD-SNMP-MIB::laConfig.1 = STRING: 12.00
UCD-SNMP-MIB::laConfig.2 = STRING: 12.00
UCD-SNMP-MIB::laConfig.3 = STRING: 12.00
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 56
UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 41
UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 35
UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 0.570000
UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 0.420000
UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 0.360000
UCD-SNMP-MIB::laErrorFlag.1 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrorFlag.2 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrorFlag.3 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrMessage.1 = STRING:
UCD-SNMP-MIB::laErrMessage.2 = STRING:
UCD-SNMP-MIB::laErrMessage.3 = STRING:
_______________________________________________ mrtg mailing list
[email protected] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg