From Boldcore's wiki
Jump to: navigation, search

PySNMP do not dive to other OIDs

I am new to this topic, but lets say, that I want from PySNMP only one OID "tree". By default, it will jump to another and print all remaining OIDs.

Here's the magic:

lexicographicMode=False
for (errorIndication, errorStatus, errorIndex, varBinds) in nextCmd(SnmpEngine(),
 UsmUserData(user, authpass, cryptpass,
 authProtocol=RetizekProkotol,
 privProtocol=NSACrypt1),
 Udp6TransportTarget(('2a02:cafe:c001:face:bad:f00d', 161)),
 ContextData(),
 ObjectType(ObjectIdentity('1.3.6.bla.bla.oid')),
 lexicographicMode=False):

Then You can print the varBinds, in the way You prefer.