请帮助提供监控设备的示例代码: IP: 192.168.123.123,MIB文件名: qwert.mib,OID:.1.3.6.1.4.1.30932.1.10.1.2.10
非常感谢。
发布于 2020-03-27 01:02:49
如果您还没有,请查看http://snmplabs.com/pysnmp pysnmp文档。它有可能会有帮助的例子和指南
发布于 2020-04-03 23:40:19
这是取自官网的一个例子:
如果您必须将demo.snmplabs.com更改为192.168.123.123,请验证您的设备是否启用了SNMP V2,以及读取社区的密码是否设置为'public',如果没有,您将不得不相应地进行更改。
from pysnmp.hlapi import *
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.6.0')))
)
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([x.prettyPrint() for x in varBind]))http://snmplabs.com/pysnmp/examples/hlapi/asyncore/sync/manager/cmdgen/snmp-versions.html
https://stackoverflow.com/questions/60853104
复制相似问题