2

I am trying to use the mib files supplied by Cisco to make sense the info obtainend by polling my switch via SNMP. It's a SG300-52P, the files can be found here.

After I placed the files in one of netsnmp's default mib directories, there were multiple errors when I tried to decode one of the description to its numeric value to verify that the mib files work. I thought about resolving the issues, but they were too numerous, so I decided to just try and get the simplest of these files to work with netsnmp. I placed only the SNMPv2-SMI file in one of netsnmp's default mib directories (because that came up in the errors and is a short file with no dependencies; I've appended the content for easy reference) and ran the following command:

snmptranslate -m SNMPv2-SMI zeroDotZero

However, this returns the following two erros:

Expected LAST-UPDATED (SMI): At line 35 in /home/buildmanager/.snmp/mibs/SNMPv2-SMI.my
zeroDotZero: Unknown Object Identifier (Sub-id not found: (top) -> zeroDotZero)

After some googling and guessing, I went ahead and checked the file with this online mib file validator here, which objected that

Line 34:
2   `SMI' should start with a lower case letter
1   syntax error, unexpected MODULE_IDENTITY, expecting OBJECT

I have no Idea what to make of these messages, googling them revealed nothing I could make sense of. Does this mean my file actually has errors? It's a file officially supplied by Cisco, and it's very basic - I can't imagine that would be the case. I've made sure that there is no interfering SNMPv2-SMI anywhere else on my system, so I'm sure that this is the file netsnmp is using. I suspect there is something here that I did not understand about SNMP and these mib files in general, so please point me at the right direction or tell me where and how to look for answers. Thanks!

Contents of SNMPv2-SMI:

-- file: SNMPv2-SMI.my
-- Changes:
--      Converted to SMIC format.
-- dperkins@scruznet.com

SNMPv2-SMI DEFINITIONS ::= BEGIN

org             OBJECT IDENTIFIER ::= { iso 3 }
dod             OBJECT IDENTIFIER ::= { org 6 }
internet        OBJECT IDENTIFIER ::= { dod 1 }
directory       OBJECT IDENTIFIER ::= { internet 1 }
mgmt            OBJECT IDENTIFIER ::= { internet 2 }
mib-2           OBJECT IDENTIFIER ::= { mgmt 1 }
transmission    OBJECT IDENTIFIER ::= { mib-2 10 }
experimental    OBJECT IDENTIFIER ::= { internet 3 }
private         OBJECT IDENTIFIER ::= { internet 4 }
enterprises     OBJECT IDENTIFIER ::= { private 1 }
security        OBJECT IDENTIFIER ::= { internet 5 }
snmpV2          OBJECT IDENTIFIER ::= { internet 6 }

-- transport domains
snmpDomains     OBJECT IDENTIFIER ::= { snmpV2 1 }

-- transport proxies
snmpProxys      OBJECT IDENTIFIER ::= { snmpV2 2 }

-- module identities
snmpModules     OBJECT IDENTIFIER ::= { snmpV2 3 }



-- macros

SMI MODULE-IDENTITY
SMI OBJECT-IDENTITY
SMI OBJECT-TYPE
SMI NOTIFICATION-TYPE


-- types

SMI Counter32
SMI Counter64
SMI Gauge32
SMI Integer32
SMI IpAddress
SMI Opaque
SMI TimeTicks
SMI BITS
SMI Unsigned32


zeroDotZero    OBJECT-IDENTITY
    STATUS     current
    DESCRIPTION
            "A value used for null identifiers."
    ::= { 0 0 }

END
fishgehoelz
  • 83
  • 1
  • 7
  • 1
    NET-SNMP itself ships with the proper MIB documents such as SNMPv2-SMI, so you don't need to use the problematic ones from Cisco. – Lex Li Jul 23 '15 at 15:06
  • What the heck. Why would Cisco supply those files then? And how am I to determine which of their files is good to use and which I should throw away? Anyway, with the one that came with NET-SNMP, I get the same error. – fishgehoelz Jul 24 '15 at 06:29
  • Some compilers automatically skip foundamental MIB documents so even if incorrect ones are served no error is reported. However, NET-SNMP is not tolerable. What is exactly the error after switching to NET-SNMP's version? You could not roughly say it doesn't work. – Lex Li Jul 24 '15 at 09:36
  • Using the SNMPv2-SMI supplied with NET-SNMP, this command: `snmptranslate zeroDotZero` returns this error: `zeroDotZero: Unknown Object Identifier (Sub-id not found: (top) -> zeroDotZero)`. – fishgehoelz Jul 24 '15 at 10:44
  • 1
    I've not used the MIB compiler from net-snmp, but do check out some other MIB compilers. There are some other software suites out there, notably "MIB Browsers" which are considerably less picky. Some let you set the pickyness level. Most of them even have GUIs. =) – Jolta Jul 30 '15 at 22:24
  • If you don't want to just Google & cross your fingers, ask at http://softwarerecs.stackexchange.com/ where someone who actually used a few MIB browers will help you select one – Mawg says reinstate Monica Dec 19 '16 at 16:35

1 Answers1

1

That SNMPv2-SMI file you quoted has been modified from the original/standard to use special syntax that is specific to the SMIC compiler (those "SMI" keywords like "SMI Counter32"), per the comments at the beginning:

--      Converted to SMIC format.

This is broken syntax (no longer valid SMIv1 or SMIv2) according to any other parser/compiler, hence the errors. You should only add MIBs to net-snmp that you need that are not already provided by it (as SNMPv2-SMI should be), and should use standard syntax, not compiler-specific extensions (unless they are implemented in comments).

Michael Kirkham
  • 1,052
  • 7
  • 16