微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用于测试 PySNMP 的 SNMP 模拟器?

如何解决用于测试 PySNMP 的 SNMP 模拟器?

我正在寻找一种测试 PySNMP 脚本的方法,因为 demo.snmplabs.com 和 snmpsim.try.thola.io 似乎已关闭 - 至少我无法从以下示例脚本中获得响应PySNMP 文档。我可以尝试其他任何主机吗?

from pysnmp.hlapi import *

for (errorIndication,errorStatus,errorIndex,varBinds) in nextCmd(SnmpEngine(),CommunityData('public'),UdpTransportTarget(('snmpsim.try.thola.io',161)),ContextData(),ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')),lookupMib=False):

    if errorIndication:
        print(errorIndication)
        break
    elif errorStatus:
        print('%s at %s' % (errorStatus.prettyPrint(),errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
        break
    else:
        print("hello")
        for varBind in varBinds:
            print(' = '.join([x.prettyPrint() for x in varBind]))

响应:超时前未收到 SNMP 响应

编辑:我已经尝试过 snmp.live.gambitcommunications.com、demo.snmplabs.com 和 snmpsim.try.thola.io 所以在这一点上我觉得我错过了一些东西。有什么想法吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。