如何通过 python 使用 auth no priv 获取 SNMPv3? 我尝试用 pysnmp 来做,但它不起作用。 设备:交换机 CISCO 2960
from pysnmp.hlapi import UsmUserData, usmHMACSHAAuthProtocol,usmAesCfb256Protocol
from pysnmp.hlapi import SnmpEngine, UdpTransportTarget, ContextData,ObjectType, ObjectIdentity, getCmd
snmpName =username
snmpPass = password
ipHost = ipAddress
auth=UsmUserData(userName=snmpName,authKey=snmpPass,authProtocol=usmHMACSHAAuthProtocol,privKey='',privProtocol=usmAesCfb256Protocol)
data = getCmd(SnmpEngine(),auth,UdpTransportTarget((ipHost, 161)),ContextData(),ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysName', 0)))
errorIndication, errorStatus, errorIndex, varBinds = next(iterator)
print(errorIndication, errorStatus, errorIndex, varBinds)
当我尝试以任何方式打印此数据时出现错误