Dec-28-2017, 08:10 AM
Hi Buran,
I am able to print Device model now.
changes in code is as below
UT
model on new line where as i want this like 1469 10.16.1.59 UT --- on same line
I am able to print Device model now.
changes in code is as below
#!/usr/bin/python from easysnmp import Session # load easysnmp module community ='public' #Community for the device oid ='SNMPv2-MIB::sysDescr.0' #sysDescr OID sr_no = 0 with open('DSLAMIP.txt') as ipfile: # line = ipfile.readlines() # print line for line in ipfile: # print line try: 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' sr_no += 1 print (str(sr_no)+' '+str(line)+' '+model) except: print(str(sr_no)+' ' +str(line)+' ' +'Connection timed out')But output is printing like 1469 10.16.1.59
UT
model on new line where as i want this like 1469 10.16.1.59 UT --- on same line