0
from pysnmp.hlapi import *

test = getCmd(SnmpEngine()
              , CommunityData('public', mpModel=0)
              , UdpTransportTarget(('192.168.0.253', 161))
              , ContextData()
              , ObjectType(ObjectIdentity('IF-MIB', 'ifDescr', 0)))

errorIndication, errorStatus, errorIndex, varBinds = next(test)

if errorIndication:  # SNMP engine errors
    print(errorIndication)
else:
    if errorStatus:  # SNMP agent errors
        print('%s at %s' % (errorStatus.prettyPrint(), varBinds[int(errorIndex) - 1] if errorIndex else '?'))
    else:
        for varBind in varBinds:  # SNMP response contents
            print(' = '.join([x.prettyPrint() for x in varBind]))

pysnmp.smi.error.SmiError: No symbol IF-MIB::ifDescr.1 at <pysnmp.smi.builder.MibBuilder object at 0x7ffbbd55ac18>

每当我尝试获取特定值 ifDescr 或在接口的输出或输入中时,我都会收到此错误(pysnmp.smi.error.SmiError: No symbol IF-MIB::ifDescr.1 at <pysnmp.smi.builder. MibBuilder 对象位于 0x7ffbbd55ac18>)。

先感谢您

4

0 回答 0