Dec-27-2017, 12:10 PM
below small script check model of device, its taking ip from file. My issue is ... how to deal with snmp timeout, script exits on snmp time out.
please support.
below small script check model of device, its taking ip from file. My issue is ... how to deal with snmp timeout, script exits on snmp time out.
please support.
#!/usr/bin/python
from easysnmp import Session
community ='public'
oid ='SNMPv2-MIB::sysDescr.0'
with open('DSLAMIP.tx') as f:
for line in f:
session = Session(hostname = line, community = community, version = 2)
snmp_get = session.get(oid)
result = snmp_get.value.encode('ascii')
if 'IES1248-51' in result:
model = 'ZyXEL'
elif 'ECI' in result:
model = 'ECI'
elif 'IP' in result:
model = 'UT'
print line +" "+ model
please support.
below small script check model of device, its taking ip from file. My issue is ... how to deal with snmp timeout, script exits on snmp time out.
please support.
#!/usr/bin/python
from easysnmp import Session
community ='public'
oid ='SNMPv2-MIB::sysDescr.0'
with open('DSLAMIP.tx') as f:
for line in f:
session = Session(hostname = line, community = community, version = 2)
snmp_get = session.get(oid)
result = snmp_get.value.encode('ascii')
if 'IES1248-51' in result:
model = 'ZyXEL'
elif 'ECI' in result:
model = 'ECI'
elif 'IP' in result:
model = 'UT'
print line +" "+ model