0

I have a situation where I'm trying to do some MIB-processing on a pre-existing, non-translated SNMP walk in the cloud. I have a set of translated PySMI MIB json files, but I'm unsure how to match the correct MIB with OIDs within the walk.

I saw in this post that PySNMP was unable to automatically detect a MIB but that it was being worked on. I tried to create a simple implementation myself using regex, but I cannot find the correlation between a MIB's module identity and the OIDs that I am retrieving from the SNMP walk.

I've seen the MIB index that can be generated from PySMI, which seemed promising, but I'm not sure how I can use that to find the human-readable version of an OID from a collection of MIB files.

What am I missing? Thanks!

Hannah
  • 5
  • 3

1 Answers1

1

A way to deal with this would be to build the OID->MIB index by running PySMI-based script (or just vanilla mibdump tool) over your entire MIB collection. Actually, such index can be found here.

Once you have this OID->MIB mapping, you could run the OIDs your snmpwalk script receives, match them (or their prefixes) against the OID->MIB map and load up the required MIBs.

Unfortunately, this relatively simple process has not been built into pysnmp yet, but it should not be hard to implement within your script.

Ilya Etingof
  • 5,440
  • 1
  • 17
  • 21
  • Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a `mibdump` and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two. – Lightness Races in Orbit Nov 21 '18 at 10:47
  • (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.) – Lightness Races in Orbit Nov 21 '18 at 10:48
  • I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;) – Ilya Etingof Nov 21 '18 at 10:53
  • Did you confuse me with the OP? – Lightness Races in Orbit Nov 21 '18 at 11:04
  • Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue. – Ilya Etingof Nov 22 '18 at 06:34
  • No, I'm adding an anecdote about something separate I did two years ago that backs up your answer. I am not the OP so I can't resolve the OP's issue – Lightness Races in Orbit Nov 22 '18 at 10:25
  • Ok, for some reason I was thinking the OID->MIB index was 1:1, but I now see that each MIB is mapped to multiple prefixes. I plan to use a regex matcher to find the closest MIB prefix and search that MIB for the information. Thanks so much for the response! – Hannah Nov 28 '18 at 16:32