To use MIB with pysnmp, you must first convert the MIB to pysnmp format (which is a collection of Python objects). The conversion is performed using the pysnmp / tools / build-pysnmp-mib shell script as follows:
$ sh build-pysnmp-mib -h build-pysnmp-mib: illegal option -- h Convert MIB text file into PySNMP-compliant module, see http://pysnmp.sf.net. Usage: build-pysnmp-mib [-o pysnmp-mib-file ] [ mib-text-file ]
Make sure you have libsmi installed (pysnmp scripts use the smidump tool from the libsmi distribution).
If you don't put your new Mys file in pysnmp in pysnmp / smi / mibs / (which isn’t very good), you will also need to point pysnmp to the place where your own MIBs are located. This can be done as described here .
Once you are done with the MIB, you can use it from your scripts, as described here .
You can quickly check how your new MIB works by calling the pysnmpget / pysnmpset tools that come with the pysnmp-apps package.
By the way, most likely, the MIB you need to work with is already converted to the pysnmp format and distributed with the pysnmp-mibs package.
source share