Troubleshoot and Compile SNMP MIBs

This document is intended to collect and provide information about SNMP MIB compilation. Hopefully, in time, the variety and amount of corner cases documented will help an OpenNMS administrator get through system installation and customization efficiently.

Note: The ultimate goal of MIB compilation is to generate an event, and to a lesser degree, data collection configuration files. Getting MIBs to compile can involve some creative workarounds and hacking to get files to work. It is not a science, but more of a balance of logic and art!

Tools

Besides the excellent SNMP MIB Compiler UI built into OpenNMS, there are some MIB validation tools around the Web. Here are a couple of examples:

MIB Compiles, but Events Fail to Generate

Sometimes a MIB will compile, but attempting to generate eventconf fails. Known reasons:

  • A TEXTUAL-CONVENTION’s SYNTAX refers to a non-base type (such as another TEXTUAL-CONVENTION). Nortel MIBs do this.

Emerson Netsure MIB- Case Matters

Sometimes a MIB is too well built!

Case in point, pun intended:

Compiling an Emerson Netsure MIB gave the following error:

Wed Jan 29 15:25:43 MST 2014 [INFO] Reading MIBs from /opt/opennms/share/mibs
Wed Jan 29 15:25:53 MST 2014 [INFO] Parsing MIB file /opt/opennms/share/mibs/pending/NetSure-ACU-Plus.mib
Wed Jan 29 15:25:53 MST 2014 [ERROR] Problem found when compiling the MIB:
ERROR: Parse error: expecting LOWER, found 'FloatCharging', Source: NetSure-ACU-Plus.mib, Row: 269, Col: 13
	    FloatCharging(2),
            ^

against this definition:

psStatusBatteryMode OBJECT-TYPE
        SYNTAX INTEGER  {
            unknown(1),
            FloatCharging(2),
            ShortTest(3),
            BCForTest(4),
            ManualTesting(5),
            PlanTesting(6),
            ACFailTesting(7),
            ACFail(8),
            ManualBC(9),
            AutoBC(10),
            CyclicBC(11),
            MasterBC(12),
            MasterBT(13)
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The status of battery modes, 
                FloatCharging(2),
                ShortTest(3),
                BoostChargingForTest(4),
                ManualTesting(5),
                PlanTesting(6),
                ACFailTesting(7),
                ACFail(8),
                ManualBoostCharging(9),
                AutoBoostCharging(10),
                CyclicBoostCharging(11),
                MasterBoostCharging(12),
                MasterBateryTesting(13)."
        ::= { system 9 }

Changing to lower case in the definition:

psStatusBatteryMode OBJECT-TYPE
        SYNTAX INTEGER {
            unknown(1),
            floatcharging(2),
            shorttest(3),
            bcfortest(4),
            manualtesting(5),
            plantesting(6),
            acfailtesting(7),
            acfail(8),
            manualbc(9),
            autobc(10),
            cyclicbc(11),
            masterbc(12),
            masterbt(13)
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The status of battery modes, 
                FloatCharging(2),
                ShortTest(3),
                BoostChargingForTest(4),
                ManualTesting(5),
                PlanTesting(6),
                ACFailTesting(7),
                ACFail(8),
                ManualBoostCharging(9),
                AutoBoostCharging(10),
                CyclicBoostCharging(11),
                MasterBoostCharging(12),
                MasterBatteryTesting(13)."
        ::= { system 9 }

And you see a successful mib compilation!

Wed Jan 29 15:41:19 MST 2014 [INFO] Parsing MIB file /opt/opennms/share/mibs/pending/NetSure-ACU-Plus.mib
Wed Jan 29 15:41:19 MST 2014 [INFO] MIB parsed successfully.
Wed Jan 29 15:41:19 MST 2014 [INFO] Renaming file NetSure-ACU-Plus.mib to EES-POWER-MIB.mib

ACX-MIB_105.mib- More Case, and more…

The ACX-MIB_105.mib is full of problems.

This

moduleComStatus OBJECT-TYPE
        SYNTAX INTEGER { ok(0), fail(1) }

NOT this

moduleComStatus OBJECT-TYPE
        SYNTAX INTEGER { OK(0), FAIL(1) }

Moving on!

ERROR: Parse error: unexpected token: (, Source: ACX-MIB_105-modified, Row: 108, Col: 30
	SYNTAX DisplayString (DD.MM.YY)

That’s great you want to specify a format, but it doesn’t follow standards…

updateDate OBJECT-TYPE
        SYNTAX DisplayString (DD.MM.YY)
        ACCESS read-write
        STATUS mandatory
        DESCRIPTION
                "Last date of updating system of the form 'DD.MM.YY'"

First try… (clue from the integer definition syntax just above!)

updateDate OBJECT-TYPE
	SYNTAX DisplayString { (DD.MM.YY) }
ERROR: Parse error: expecting LOWER, found '(', Source: ACX-MIB_105-modified, Row: 108, Col: 32
	SYNTAX DisplayString { (DD.MM.YY) }

Ah! Now on more familiar ground. Third try

updateDate OBJECT-TYPE
	SYNTAX DisplayString { (dd.mm.yy) }
ERROR: Parse error: expecting LOWER, found '(', Source: ACX-MIB_105-modified, Row: 108, Col: 32
	SYNTAX DisplayString { (dd.mm.yy) }

Still not happy? How about

updateDate OBJECT-TYPE
	SYNTAX DisplayString { dd.mm.yy }

Nope…

ERROR: Parse error: expecting L_PAREN, found '.', Source: ACX-MIB_105-modified, Row: 108, Col: 34
	SYNTAX DisplayString { dd.mm.yy }

Still not happy. Well this simplification works.

updateDate OBJECT-TYPE
	SYNTAX DisplayString

Next up, sometimes you need uppercase!

ERROR: Parse error: expecting UPPER, found 'dcdcModuleEntry', Source: ACX-MIB_105-modified, Row: 1229, Col: 24
    SYNTAX SEQUENCE OF dcdcModuleEntry

We find

dcdcTable OBJECT-TYPE
    SYNTAX SEQUENCE OF dcdcModuleEntry
    ACCESS not-accessible
    STATUS mandatory
    DESCRIPTION
        "DCDC Module Information Table"
    ::= { dcdcInfo 2 }
   
dcdcModuleEntry OBJECT-TYPE
    SYNTAX dcdcModuleEntry
    ACCESS not-accessible
    STATUS mandatory
    DESCRIPTION
        "Queue of DCDC Module Table"
    INDEX { dcdcModuleIndex }
     ::= { dcdcTable 1 }

dcdcModuleEntry ::=
    SEQUENCE {
        dcdcModuleIndex
            INTEGER,

Then give the entry an uppercase entry-

dcdcTable OBJECT-TYPE
    SYNTAX SEQUENCE OF DcdcModuleEntry
    ACCESS not-accessible
    STATUS mandatory
    DESCRIPTION
        "DCDC Module Information Table"
    ::= { dcdcInfo 2 }

dcdcModuleEntry OBJECT-TYPE
    SYNTAX DcdcModuleEntry
    ACCESS not-accessible
    STATUS mandatory
    DESCRIPTION
        "Queue of DCDC Module Table"
    INDEX { dcdcModuleIndex }
     ::= { dcdcTable 1 }

DcdcModuleEntry ::=
    SEQUENCE {
        dcdcModuleIndex

Similar fix with the next error-

ERROR: Parse error: expecting UPPER, found 'sliModuleEntry', Source: ACX-MIB_105-modified, Row: 1410, Col: 24
    SYNTAX SEQUENCE OF sliModuleEntry
                      ^

Then we get this!

ERROR: Cannot find symbol snmpTrapOID, Source: ACX-MIB_105-modified, Row: 1618, Col: 19
	OBJECTS { snmpTrapOID }
                  ^
ERROR: Cannot find symbol snmpTrapOID, Source: ACX-MIB_105-modified, Row: 1626, Col: 19
	OBJECTS { snmpTrapOID }
                  ^
ERROR: Cannot find symbol snmpTrapOID, Source: ACX-MIB_105-modified, Row: 1633, Col: 19
	OBJECTS { snmpTrapOID }
                  ^
ERROR: Cannot find symbol snmpTrapOID, Source: ACX-MIB_105-modified, Row: 1640, Col: 19
	OBJECTS { snmpTrapOID }
                  ^

This repeats for many lines. The first entries look like this-

lowVoltTrap NOTIFICATION-TYPE
        OBJECTS { snmpTrapOID }
        STATUS current
    DESCRIPTION
            "Low DC Voltage Alarm "
    ::= { powecACXTrap 1 }


highVoltTrap NOTIFICATION-TYPE
        OBJECTS { snmpTrapOID }
        STATUS current
    DESCRIPTION
            "High DC Voltage Alarm"
    ::= { powecACXTrap 2 }

They appear to reference an object, but where is the object? It isn’t defined or imported, so where can it be?

$ grep -i snmptrapoid *
SNMPv2-MIB.txt:snmpTrapOID OBJECT-TYPE
SNMPv2-MIB.txt:    OBJECTS { snmpTrapOID, snmpTrapEnterprise }

There it is. Adding it to the imports list

        IMPORTS

        enterprises, IpAddress          FROM RFC1155-SMI
        DisplayString                   FROM RFC1213-MIB
        OBJECT-TYPE                     FROM SNMPv2-SMI
        TRAP-TYPE                       FROM RFC-1215
        snmpTrapOID                     FROM SNMPv2-MIB;

FINALLY SUCCESS!

Thu Aug 27 12:01:08 PDT 2015 [INFO] Parsing MIB file /opt/opennms/share/mibs/pending/ACX-MIB_105-modified
Thu Aug 27 12:01:09 PDT 2015 [INFO] MIB parsed successfully.
Thu Aug 27 12:01:09 PDT 2015 [INFO] Renaming file ACX-MIB_105-modified to ACX-MIB.mib
2 Likes