pysnmp [snmp客户端]

    #!/usr/bin/python
    from pysnmp.entity.rfc3413.oneliner import cmdgen

    cg = cmdgen.CommandGenerator()

    # 注意IP 端口 组默认public  oid值
    varBinds = cg.getCmd( cmdgen.CommunityData('any-agent', 'public',0 ), cmdgen.UdpTransportTarget(('10.10.76.42', 161)),    (1,3,6,1,4,1,2021,10,1,3,1), )

    print varBinds[3][0][1]
文档更新时间: 2018-11-21 17:34   作者:RuM