Apr-05-2018, 06:18 PM
from easysnmp import snmp_get, snmp_set, snmp_walk from collections import Counter import sys #start = time.time() host = '172.19.2.130' interface = [] interfaceoid = '1.3.6.1.2.1.2.2.1.1' indexwalk = snmp_walk(interfaceoid, hostname=host, community='sky123', version=2) interfaces = [item.value for item in indexwalk] interface.append(interfaces) for x in iter(interface): b = interfaceoid+'.'+ ''.join(x) print (b)
Output:1.3.6.1.2.1.2.2.1.1.285278721285278722285278723285278724285278725285278726285278727285278728285278729285278730285278731285278732285278733285278734285278735285278736285278977285278978285278979285278980285278981285278982285278983285278984285278985285278986285278987285278988285278989285278990285278991285278992285280769285280770285280771285280772285280773285281025285281026285281027285281028285281029285282817553648129654311425
expected output isOutput:1.3.6.1.2.1.2.2.1.1.285278721
1.3.6.1.2.1.2.2.1.1.285278722
1.3.6.1.2.1.2.2.1.1.285278723
1.3.6.1.2.1.2.2.1.1.285278724