我在android中有一个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,12619,1)的根oid。但是使用该OID的输出是:
OIDs are not increasing怎样才能让它工作呢?
发布于 2017-02-20 19:39:22
ignoreNonIncreasingOid =真
将该参数作为选项添加可以使其正常工作。
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),
ignoreNonIncreasingOid = True
)https://stackoverflow.com/questions/42343071
复制相似问题