嘗試使這兩個lookupMib=False和lexicographicMode=False到nextCmd()或bulkCmd():
from pysnmp.hlapi import *
for errorIndication, errorStatus, \
errorIndex, varBinds in bulkCmd(
SnmpEngine(),
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
0, 50, # GETBULK specific: request up to 50 OIDs in a single response
ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2.1.8')),
lookupMib=False, lexicographicMode=False):
if errorIndication:
print(errorIndication)
break
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex)-1][0] or '?'))
break
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))