Mar-07-2018, 07:16 AM
from easysnmp import Session host = '10.124.xxx.xx' session = Session(hostname=host, community='xxxwifi', version=2) # Perform an SNMP walk system_items = session.walk('1.3.6.1.4.1.25053.1.3.2.1.1.2.2.1.1') # Each returned item can be used normally as its related type (str or int) # but also has several extended attributes with SNMP-specific information for item in system_items: print '{oid}.{oid_index} {snmp_type} = {value}'.format( oid=item.oid, oid_index=item.oid_index, snmp_type=item.snmp_type, value=item.value )Not able to print output
Error:Traceback (most recent call last):
File "WLC1.py", line 39, in <module>
value=item.value
UnicodeEncodeError: 'ascii' codec can't encode character u'\xaa' in position 2: ordinal not in range(128)
snmpwalk output is as belowOutput:[anna]# snmpwalk -v2c -c xxx 10.124.xxx.xx 1.3.6.1.4.1.25053.1.3.2.1.1.2.2.1.1
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.4.79.170.52.162.128 = Hex-STRING: 04 4F AA 34 A2 80
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.4.79.170.52.167.32 = Hex-STRING: 04 4F AA 34 A7 20
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.1.204.80 = Hex-STRING: 1C B9 C4 01 CC 50
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.1.233.176 = Hex-STRING: 1C B9 C4 01 E9 B0
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.121.112 = Hex-STRING: 1C B9 C4 03 79 70
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.122.160 = Hex-STRING: 1C B9 C4 03 7A A0
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.123.0 = Hex-STRING: 1C B9 C4 03 7B 00
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.124.16 = Hex-STRING: 1C B9 C4 03 7C 10
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.125.128 = Hex-STRING: 1C B9 C4 03 7D 80
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.125.208 = Hex-STRING: 1C B9 C4 03 7D D0
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.126.112 = Hex-STRING: 1C B9 C4 03 7E 70
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.133.192 = Hex-STRING: 1C B9 C4 03 85 C0
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.133.208 = Hex-STRING: 1C B9 C4 03 85 D0
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.134.240 = Hex-STRING: 1C B9 C4 03 86 F0
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.135.144 = Hex-STRING: 1C B9 C4 03 87 90
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.138.32 = Hex-STRING: 1C B9 C4 03 8A 20
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.139.0 = Hex-STRING: 1C B9 C4 03 8B 00
SNMPv2-SMI::enterprises.25053.1.3.2.1.1.2.2.1.1.6.28.185.196.3.139.64 = Hex-STRING: 1C B9 C4 03 8B 40