[erlang-questions] MIB compiler errors for common MIBS

Wolf, Dave dave.wolf@REDACTED
Tue Sep 3 14:48:41 CEST 2019


Hi Daniel,

I think I finally got it!  I followed your advice and restructered all the tables, but was still getting a “corrupt table definition”.  Whomever created this MIB file commented out the circuits, circuitBreakers, outlets, tHSensors in the rackPowerPDUGroup below so there was a mismatch between PduEntry and the group (or at least I think that was it because  I commented out the same lines in the PduEntry and it compiles now).  Once again, many thanks for your answers to my questions, I’m glad I didn’t quite reach the end of your tips and tricks!

Best regards,
Dave Wolf


                PduEntry ::=
                                SEQUENCE {
                                                pduIndex                                            INTEGER,
                                                pduModel                                           DisplayString,
                                                pduID                                                    DisplayString,
                                                pduName                                                            DisplayString,
                                                pduLocation                                       DisplayString,
                                                pduGroupNumber                                          DisplayString,
                                                pduMainLoadVoltage                    DisplayString,
                                                pduMainLoadAmp                                          INTEGER,
                                                pduMainPowerFactor                    DisplayString,
                                                pduMainActivePower                    INTEGER,
                                                pduMainApparentPower                              INTEGER,
                                                pduMainCumulativeEnergy                         INTEGER,
                                                pduRealTimeClock                           DisplayString
                                                circuits                                  DisplayString,
                                                circuitBreakers                                  DisplayString,
                                                outlets                                                  DisplayString,
                                                tHSensors                                           DisplayString
                                                }
                rackPowerPDUGroup OBJECT-GROUP
                       OBJECTS { pduIndex,
                                                pduModel,
                                                pduID,
                                                pduName,
                                                pduLocation,
                                                pduGroupNumber,
                                                pduMainLoadVoltage,
                                                pduMainLoadAmp,
                                                pduMainPowerFactor,
                                                pduMainActivePower,
                                                pduMainApparentPower,
                                                pduMainCumulativeEnergy,
                                                pduRealTimeClock
                                                --circuits,
                                                --circuitBreakers,
                                                --outlets,
                                                --tHSensors
                                                 }
                       STATUS  current
                       DESCRIPTION
                                       "A collection of objects providing basic instrumentation
                                       and control of the PDU."
                      ::= { rackPowerMIBGroups 2 }

From: Dániel Szoboszlay <dszoboszlay@REDACTED>
Sent: Friday, August 30, 2019 2:36 PM
To: Wolf, Dave (SI SSP R&D ATL) <dave.wolf@REDACTED>
Cc: erlang-questions@REDACTED
Subject: Re: [erlang-questions] MIB compiler errors for common MIBS

Try reordering the definitions related to the pduTable like this:

pduTable (the table definition)
pduEntry (the row definition)
definitions of all the columns in the table in the order they appear in the pduEntry sequence (so pduIndex, pduModel, pduID, ...)

Make sure no other object definitions are left between the above (so e.g. define circuitTable and its row and columns after fully defining everything related to pduTable).

Keeping definitions of all objects related to a table together in one block is one more thing the MIB compiler is picky about. Also, if table X uses a column from table Y as an index (e.g. simlar to circuitTable using pduIndex as an index) than X should be defined after Y.

I hope you won't run into any more issues, because I'm running out of tips & tricks. :)
I remember we once encountered a MIB with a table where the row's OID was not the { tableOID 1} but { tableOID 2 } or something. This definition was impossible to compile with OTP, and we either had to change the MIB or patch OTP, I don't remember which one. Fingers crossed for you not to encounter any weirdness like this!

Cheers,
Daniel


On Fri, 30 Aug 2019 at 16:57, Wolf, Dave <dave.wolf@REDACTED<mailto:dave.wolf@REDACTED>> wrote:
After further review, I have fixed all of the errors, except the following (they were as Daniel described, object identifiers defined in reverse order):

C:\Program Files\erl10.1\lib\snmp-5.2.12\mibs>erlc RACKPOWER-MIB.mib
RACKPOWER-MIB.mib: 1654: Corrupt table definition.
RACKPOWER-MIB.mib: Table 'pduTable' must have at least one accessible column.
compilation_failed

If anyone could help with this last one, I would be very grateful!

Thanks,
Dave.

From: erlang-questions-bounces@REDACTED<mailto:erlang-questions-bounces@REDACTED> <erlang-questions-bounces@REDACTED<mailto:erlang-questions-bounces@REDACTED>> On Behalf Of [ext] Wolf, Dave
Sent: Friday, August 30, 2019 10:04 AM
To: Dániel Szoboszlay <dszoboszlay@REDACTED<mailto:dszoboszlay@REDACTED>>; erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>
Subject: Re: [erlang-questions] MIB compiler errors for common MIBS

Hi Daniel,

Thanks, this helps a lot; however, I am now met with another set of errors that I can’t seem to figure out as well, from another MIB file we are using from RackPower for their line of PDUs.  I’m met with several of these errors below (full list is in attached output.txt file).  OBJECT-TYPE is imported by SNMPv2-SMI, so that shouldn’t be an issue.  What puzzles me is the ‘not-accessible’ possibility.  I’ve looked at the objects in my first file I posted from yesterday and these don’t look different and that file compiles after the assistance I received yesterday.  I gotta be missing something.  I appreciate the responses I have received, this is all rather new and I am slowly learning.  Any assistance anyone can provide would be greatly appreciated!

Thanks,
Dave.

C:\Program Files\erl10.1\lib\snmp-5.2.12\mibs>erlc RACKPOWER-MIB.mib
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayModel'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayFirmware'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayName'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayLocation'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayMacAddress'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayIpAddressIpv4'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewaySubnetIpv4'
RACKPOWER-MIB.mib: 100: OBJECT-TYPE definition missing or 'not-accessible' for 'ipgatewayGatewayIpv4'
RACKPOWER-MIB.mib: 114: OBJECT-TYPE definition missing or 'not-accessible' for 'pduIndex'
RACKPOWER-MIB.mib: 114: OBJECT-TYPE definition missing or 'not-accessible' for 'pduModel'
RACKPOWER-MIB.mib: 114: OBJECT-TYPE definition missing or 'not-accessible' for 'pduID'
RACKPOWER-MIB.mib: 114: OBJECT-TYPE definition missing or 'not-accessible' for 'pduName'
<<snip>>


From: erlang-questions-bounces@REDACTED<mailto:erlang-questions-bounces@REDACTED> <erlang-questions-bounces@REDACTED<mailto:erlang-questions-bounces@REDACTED>> On Behalf Of Dániel Szoboszlay
Sent: Thursday, August 29, 2019 3:41 PM
To: erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>
Subject: Re: [erlang-questions] MIB compiler errors for common MIBS

Hi,

My memories about the OTP MIB compiler are not very fresh, but back in the days I used it a lot I noticed that it's much more picky than other MIB-handling tools. Errors like the ones you encountered had to be fixed manually in most MIBs we got from equipment vendors. For example the TEXTUAL-CONVENTION macro is defined in SNMPv2-TC, and I guess most other tools simply auto-import all these definitions from the standard MIBs. When working with the OTP MIB compiler, you have to explicitly import it. mib-2 is similarly defined in SNMPv2-SMI, and you have to explicitly import it from there.

An other common issue was object identifiers defined in reverse order (parent comes after child in the MIB file). You have to simply reverse the order of the definitions to please the compiler.

Hope it helps,
Daniel

On Thu, 29 Aug 2019 at 18:46, Wolf, Dave <dave.wolf@REDACTED<mailto:dave.wolf@REDACTED>> wrote:
Hi all,

I am working on an SNMP application that polls SNMP devices and currently it works fine if I use OIDs, but I’d like to be able to load the MIB file for the device and poll using the name associated with the OID.  The issue I am running into is that for most of my MIB files I downloaded from the manufacturer sites, the MIB compiler in Erlang encounters errors during the compile to .bin format.  I am wondering if I need to compile it in a certain directory, but I am not sure why it is failing.  Here are beginning lines of the output from an example (full errors attached in output.txt) of this command:  “erlc UPS-MIB.mib”.  I have tried this on Windows and Linux hosts with the same results.

UPS-MIB.mib: 38: Macro 'TEXTUAL-CONVENTION' not imported.
UPS-MIB.mib: 45: Macro 'TEXTUAL-CONVENTION' not imported.
UPS-MIB.mib: 18: OBJECT IDENTIFIER [upsMIB] defined in terms of undefined parent object. Parent: ''mib-2''.(Sub-indexes: [33].)
UPS-MIB.mib: 52: OBJECT IDENTIFIER [upsObjects] defined in terms of undefined parent object. Parent: 'upsMIB'.(Sub-indexes: [1].)
UPS-MIB.mib: 62: OBJECT IDENTIFIER [upsIdent] defined in terms of undefined parent object. Parent: 'upsObjects'.(Sub-indexes: [1].)
UPS-MIB.mib: 64: OBJECT IDENTIFIER [upsIdentManufacturer] defined in terms of undefined parent object. Parent: 'upsIdent'.(Sub-indexes: [1].)
UPS-MIB.mib: 72: OBJECT IDENTIFIER [upsIdentModel] defined in terms of undefined parent object. Parent: 'upsIdent'.(Sub-indexes: [2].)
<<snip>>

I’ve attached the MIB file in case someone wants to give it a shot and tell me the errors of my ways.  I have loaded this exact MIB file into a MIB browser and it works just fine, I can browse the device without any issues.  Is there another way I can compile this MIB file?  Is it in a common format that other tools might be able to compile?

If anyone has any suggestions or needs further infomation, please let me know.

Thanks!
Dave Wolf.
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>
http://erlang.org/mailman/listinfo/erlang-questions<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ferlang.org%2Fmailman%2Flistinfo%2Ferlang-questions&data=02%7C01%7Cdave.wolf%40siemens.com%7Cc525736a0b6747ac570408d72d79004a%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637027870026703405&sdata=P7KsTXzEx5v7S6xRSND1ZZ5QKPYHHyj4bYWdof%2FyNNc%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190903/e4345e0f/attachment.htm>


More information about the erlang-questions mailing list