SNMP MIBs on Ubuntu - error in MIBs
I'm concerned that the definitive set of MIB files for Ubuntu seems to have syntactic errors. Am I using the wrong MIBs?
I have used
sudo apt-get install snmp-mibs-downloader
sudo download-mibs
to install an extensive set of MIBs that seem to work well, I can snmpwalk and snmptranslate pretty much as expected. However I see a few errors each time I run those commands indicating that the MIBs have a few syntactic errors.
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Unlinked OID in IPATM-IPMC-MIB: marsMIB ::= { mib-2 57 }
Undefined identifier: mib-2 near line 18 of /usr/share/mibs/ietf/IPATM-IPMC-MIB
Expected "::=" (RFC5644): At line 493 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Expected "{" (EOF): At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad object identifier: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad parse of OBJECT-IDENTITY: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Taking just one example:
Unlinked OID in IPATM-IPMC-MIB: marsMIB ::= { mib-2 57 }
the error here is that mib-2 is missing from the Imports.
While I could try to work my way through and fix these errors, I'm concerned that I'm not using the correct MIBs. Surely these errors shouldn't be occurring?
My snmp.conf has
mibs +ALL
I think this is necessary, if as some advise we comment that line out we don't seem to get the full set of OIDs when walking the tree.
Solution 1:
Which version of Ubuntu are you using?
Ubuntu probably gets its snmp-mibs-downloader
package from Debian, and Debian is very strict about redistributability, so the snmp-mibs-downloader
gets its MIBs from public sources, including the actual RFCs and other standards documents in the internet.
However, some of those standards documents contain typos and other errors... and in some cases, fixing those would apparently require issuing a completely new revision of the appropriate standards document. And that would take considerable time and effort. (There may be official errata documents instead, but those are not necessarily in a format suitable for automatic patching.)
In Debian, the current version of snmp-mibs-downloader
includes a .diff
file that is applied to fix a number of errors in various RFC-based MIBs, but it was not always so. The list of errors you included looks familiar to me...
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584657
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689483
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689485
All these and more were fixed in version 1.1+nmu1 of snmp-mib-downloader
, which was originally released in September 2016. If you're using a version older than that, and there is no update available for your version of Ubuntu, consider downloading the MIBs on some other computer that has a newer version of the package, and then copying the resulting fixed MIBs to wherever you need them.
After that, there should be just one error left:
Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
This webpage has a link to a pastebin containing a fixed SNMPv2-PDU MIB file. The modification just replaces the named constant integer value max-bindings
with its actual numeric value and comments out the constant definition, and likewise adjusts the definition of BulkPDU to be completely self-contained. Those changes make the net-snmp MIB parser happy.
Alternatively you can just delete the SNMPv2-PDU MIB file, since it's just a formal definition of SNMPv2 protocol data units, and that definition is already built-in to most SNMP tools.