Python Forum

Full Version: how to deal with easysnmp timeout
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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