[mrtg] mrtg-2.14.5-4 (Centos5): oid-mib-cache.txt not created (w/solution)

Alessandro Forghieri alf at orion.it
Wed Feb 5 17:00:57 CET 2014


Greetings.
This may be an old bug - hard to say with the trac access sealed in the
web site - but it's happened to me plenty and recently, and the 'net is
quiet about it.
Hopefully this'll help some poor schmuck

I have seen that in the above (subject) mentioned conditions it may
happen that a
clean configuration file starts acting up by spewing 

Unknown SNMP Variable

errors.

Others have met this as well.: see https://lists.oetiker.ch/pipermail/mrtg/2011-March/036481.html)

As explained in the link, the apparent cause of the error is a missing /var/lib/mrtg/oid-mib-cache.txt file 
that should be automatically created and populated with name-to-oid translations loaded from the LoadMib specified files
(but isn't). One unpleasant solution is creating the file by hand.

The root cause I found for this is as follows.
The mrtg distro apparently ships with two similarly named files:

Net_SNMP_util.pm

and 

SNMP_util.pm

They are different but contain similarly named functions and it turns out that MRTG mixes up calls between the two. 
In this particular case, when parsing the cfg file MRTG_lib.pm calls (line 681):

snmpQueue_MIB_File($mibFile)

stepping through in the debugger, it is possible to see that this is 


Net_SNMP_util::snmpQueue_MIB_File

the name-to-oid translation, however, is made through SNMP_utils::toOID function. This does not know about the MIB files (they have been 
queued in the wrong module, above) and so it breaks.
Replacing;


snmpQueue_MIB_File($mibFile)


with 
 
SNMP_util::snmpQueue_MIB_File($mibFile)

Makes all the error go away. The reason of the mixup or of the presence of two SNMP libraries, I cannot fathom. I'd bet that one OR the other should be present 
and that shipping both causes the snafu, but that's me. Maybe removing one or the other fixes everything as well - or it may make it worse - I did not try that.

Cheers,
alf










-- 
Alessandro Forghieri
Nouvelle s.r.l.
via Giardini 456/C 41124 Modena  (ITALY)
tel. +39 059 2929338 - Fax +39 059 347606

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20140205/dbdf8aa3/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alf.vcf
Type: text/x-vcard
Size: 257 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20140205/dbdf8aa3/attachment.vcf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20140205/dbdf8aa3/attachment.pgp 


More information about the mrtg mailing list