0
我在android中有一個SNMP代理。 我想這個python腳本恢復整個MIBTree:SNMP:使用批量命令用python恢復整個MIBtree
from pysnmp.entity.rfc3413.oneliner import cmdgen
cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, \
varBinds = cmdGen.bulkCmd(
cmdgen.CommunityData('public', mpModel=0),
cmdgen.UdpTransportTarget(('192.168.0.90', 32150)),
0,
25,
(1,3,6,1,4,1,12619,1,1)
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([repr(x) for x in varBind]))
如果我使用OID(1,3,6,1,4,1,12619,1,1)的根OID ,輸出是這樣的:
ObjectType(ObjectIdentity(ObjectName('1.3.6.1.4.1.12619.1.1.1.0')),OctetString('intel ICI101'))
ObjectType(ObjectIdentity(ObjectName('1.3.6.1.4.1.12619.1.1.2.0')),OctetString('4.4.4'))
ObjectType(ObjectIdentity(ObjectName('1.3.6.1.4.1.12619.1.1.3.0')), TimeTicks(10100333))
(ObjectIdentity(ObjectName('1.3.6.1.4.1.12619.1.2.1.0')), EndOfMibView())
它工作正常。問題是我想要整個MIB樹,所以我想使用根號(1,3,6,1,4,1,126,19,1)。但是使用該OID的輸出是:
OIDs are not increasing
如何使這項工作?