我的程序在下面取出叶节点OID(子oid)值,但是当我在Wireshark中检查网络流量时,有一个请求&每个OID的响应。那没关系,但是现在在我的程序中你可以帮我打5个或者n个父OID,这样我就可以异步地浏览它的所有子oid了吗?相反,等待第一个父母oid的子oid被覆盖而不是下一个。
WireShark请求/回复capture。
我的计划:
from pysnmp.hlapi import *
import sys
def walk(host, oid):
for (errorIndication,
errorStatus,
errorIndex,
varBinds) in nextCmd(SnmpEngine(),
CommunityData('public'),
UdpTransportTarget((host, 161)),
ContextData(),
ObjectType(ObjectIdentity(oid)),
lookupMib=False,
lexicographicMode=True):
if errorIndication:
print(errorIndication, file=sys.stderr)
break
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'), file=sys.stderr)
break
else:
for varBind in varBinds:
print('%s = %s' % varBind)
walk('10.78.163.39',
'.1.3.6.1.4.1.5296.1.9.1.1.2.8.115.101.99.101.109.115.57.57.1.47')