parsing SNMP MIB files (OID translation)

johndodo picture johndodo · Sep 28, 2011 · Viewed 10.1k times · Source

I am making a network device monitor. Part of it is a PHP front-end where user can enter the SNMP values he is interested in (SNMP OIDs). I want to make the process simpler for the user so I want to create a simple MIB browser, allowing user to select the value(s) from the tree.

The problem is reading MIB files to database (or at least XML-like format) from where I could present them to the user. Parsing MIB files on-the-fly seems wasteful to me so that rules out PHP's snmp_read_mib() - unless I can read MIB once and save the OID translations to DB?

Also, I would like to avoid writing my own parser if possible. :)

I have found libsmi but I'm not sure how to use it for this case... I tried using smidump but could only create some short XML with no useful content. I didn't try xmldump yet though, because it is not available on Debian (as package) and would have to build it from sources. Also, I think it is from 2005. Would it help?

So the question is: how can I read OID names and/or other data (SNMP Trap info) from MIB files and convert them to some ready-to-use format?

Answer

johndodo picture johndodo · Oct 3, 2011

I ended up using Mibble - I wrote a small program which uses this library to parse the MIBs and outputs the data. Very simple and seems to work nicely.

Still, thank you both for trying to help me - I appreciate it!