https://www.cnblogs.com/fyly/p/10831075.html

 

pip install easysnmp linux

from easysnmp import snmp_walk

device_ip = 'IP地址'
community = '团体字'
# oid = 'IF-MIB::ifDescr'
oid = 'sysDescr'

def test():
    res = snmp_walk(oid, hostname=device_ip, community=community, version=2)

    for each in res:
        print(each.value)
     
if __name__ == '__main__':
    test()

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注