How to get the description and other fields from the MIB file, knowing the OID?

83 Views Asked by At

With the help of the pysnmp library, I can find out the names by OID, but how do I find out the rest of the fields from the MIB file?

I get the name like this(label):

mibBuilder = builder.MibBuilder()
compiler.addMibCompiler(mibBuilder, sources=['/home/test/etc/mibs'])
mibBuilder.loadModules('IF-MIB', "CISCO-ENHANCED-MEMPOOL-MIB")
mibView = view.MibViewController(mibBuilder)

oid, label, suffix = mibView.getNodeName((1, 3, 6, 1, 4, 1, 9, 9, 221, 1, 1, 1, 1, 26))
1

There are 1 best solutions below

0
Lex Li On

You need to access the MibNode object as showed in the example,

https://github.com/lextudio/pysnmp/blob/v6.0.5/examples/smi/manager/print-oid-description.py#L30

Sadly its actual type is loaded dynamically from the compiled MIB documents (.py), so to know what methods/properties you can use you need to read the actual Cisco* objects in those compiled documents.