7

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.

9

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.

| improve this answer | |
  • Thank you, that explains the underlying reasons for the problem. I have a small puzzlement as to how fix my environment, but that merits a separate question. – djna Oct 18 '18 at 15:01
  • I have upgraded to 1.1+nmu1 as per this question: serverfault.com/questions/936185/… this fixes all the MIB errors except for "Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU". – djna Oct 19 '18 at 6:54
  • 1
    If you google for the error message, you'll find it's a long-standing problem that comes up with any programs using net-snmp MIB parsing routines. But it appears that SNMPv2-PDU just formally defines the SNMPv2 protocol data units, so that definition is already built-in into most SNMP tools and you can just delete the SNMPv2-PDU file. If you don't want to do that, this webpage has a link to a pastebin containing a minimally modified SNMPv2-PDU MIB file that works around the error. – telcoM Oct 19 '18 at 7:38
  • The modified SNMPv2-PDU just replaces the named constant integer value max-bindings with its actual numeric value and comments out the constant definition, and that makes the net-snmp MIB parser happy. – telcoM Oct 19 '18 at 7:41
  • 1
    thanks very much. I did try that myself but hit another issue. The line VarBindList ::= SEQUENCE (SIZE (0..2147483647)) OF VarBind is invalid. The modified file you suggest also comments-out that line and adjusts the definition of BulkPDU which tried to use it. – djna Oct 19 '18 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.