Posts: 221
Threads: 71
Joined: Dec 2017
Sorry Wavic, fail to understand this.
Posts: 2,953
Threads: 48
Joined: Sep 2016
These characters you're trying to print. They have no graphical representation.
Posts: 221
Threads: 71
Joined: Dec 2017
Mar-07-2018, 05:47 PM
(This post was last modified: Mar-07-2018, 06:12 PM by anna.)
its working now...
Easysnmp doesn't honour the textual conventions when MIBs are loaded.
from easysnmp import Session
# Create an SNMP session to be used for all our requests
session = Session(hostname='10.124.xxx.xx', 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')
for item in system_items:
print ':'.join('{:02x}'.format(ord(x)) for x in item.value) Output: 04:4f:aa:34:a2:80
04:4f:aa:34:a7:20
1c:b9:c4:01:cc:50
1c:b9:c4:01:e9:b0
1c:b9:c4:03:79:70
1c:b9:c4:03:7a:a0
1c:b9:c4:03:7b:00
command line output
Output: 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
Help required now, not able to print for multiple oid, something going wrong
host = '10.124.115.10'
session = Session(hostname=host, community='ttlwifi', version=2)
WLCip,SCGAPMac = (list(session.bulkwalk('1.3.6.1.4.1.25053.1.3.2.1.1.2.2.1.' + c ,non_repeaters=0, max_repetitions=50)) for c in ('1','10'))
for i in range(len(WLCip)):
mac_address = ':'.join('{:02x}'.format(ord(x)) for x in SCGAPMac[i].value)
#print (SCGAPMac[i].value)
#print (mac_address)
print (u'{} {} {}'.format(host,mac_address,WLCip[i].value)) Output: 10.124.115.10 31:30:2e:31:33:38:2e:34:2e:31:36:35 Oª4¢�
10.124.115.10 31:30:2e:31:33:38:2e:34:2e:31:36:34 Oª4§
10.124.115.10 31:30:2e:31:33:39:2e:32:32:2e:34:36 ¹ÄÌP
10.124.115.10 31:30:2e:31:33:39:2e:32:33:2e:39 ¹Äé°
10.124.115.10 31:30:2e:31:33:38:2e:33:39:2e:32:30 ¹Äyp
10.124.115.10 31:30:2e:31:33:39:2e:32:32:2e:33:38 ¹Äz
10.124.115.10 31:30:2e:31:33:39:2e:37:2e:36 ¹Ä{
10.124.115.10 31:30:2e:31:33:39:2e:37:2e:37 ¹Ä|
10.124.115.10 31:30:2e:31:33:39:2e:32:32:2e:31:37:38 ¹Ä}�
10.124.115.10 31:30:2e:31:33:39:2e:36:2e:36 ¹Ä}Ð
10.124.115.10 31:30:2e:31:33:39:2e:32:32:2e:33:39 ¹Ä~p
10.124.115.10 31:30:2e:31:33:39:2e:36:2e:38 ¹Ä�À
Posts: 4,802
Threads: 77
Joined: Jan 2018
Why dont you start with
print (u'{} {} {}'.format(host,mac_address,repr(WLCip[i].value)))
Posts: 221
Threads: 71
Joined: Dec 2017
is this correct?
session = Session(hostname=host, community='ttlwifi', version=2)
WLCip,SCGAPMac = (list(session.bulkwalk('1.3.6.1.4.1.25053.1.3.2.1.1.2.2.1.' + c ,non_repeaters=0, max_repetitions=50)) for c in ('1','10'))
for i in range(len(WLCip)):
mac_address = ':'.join('{:02x}'.format(ord(x)) for x in SCGAPMac[i].value)
#print (u'{} {}'.format(host, (':'.join('{:02x}'.format(ord(x)) for x in SCGAPMac[i].value))))
print (u'{} {} {}'.format(host,mac_address,repr(WLCip[i].value))) Output: 10.124.115.10 31:30:2e:31:33:39:2e:32:32:2e:31:30 u'\xf0>\x90\x1f\xe0\x10'
10.124.115.10 31:30:2e:31:33:39:2e:32:32:2e:31:30:39 u'\xf0>\x90\x1f\xe0 '
10.124.115.10 31:30:2e:31:33:39:2e:38:2e:38:31 u'\xf0>\x90\x1f\xe0\xa0'
10.124.115.10 31:30:2e:31:33:39:2e:36:2e:32:31 u'\xf0>\x90\x1f\xe0\xb0'
10.124.115.10 31:30:2e:31:33:39:2e:36:2e:34:32 u'\xf0>\x90\x1f\xe0\xc0'
10.124.115.10 31:30:2e:31:33:39:2e:38:2e:37:36 u'\xf0>\x90\x1f\xe0\xe0'
10.124.115.10 31:30:2e:31:33:39:2e:38:2e:37:35 u'\xf0>\x90\x1f\xe1\x00'
10.124.115.10 34:39:2e:32:34:38:2e:32:33:2e:31:34:36 u'\xf0>\x90!\xd0@'
10.124.115.10 31:30:2e:31:33:38:2e:33:39:2e:31:39 u'\xf8\xe7\x1e\x1e\xf2 '
Posts: 4,802
Threads: 77
Joined: Jan 2018
You can do the same for WLCip[i].value as you did for SCGAPMac[i].value .
Posts: 221
Threads: 71
Joined: Dec 2017
Mar-08-2018, 10:10 AM
(This post was last modified: Mar-08-2018, 10:15 AM by anna.)
this may be crude way, but solving by purpose, is there any other way?
session = Session(hostname=host, community='xxxwifi', version=2)
system_items = session.bulkwalk('1.3.6.1.4.1.25053.1.3.2.1.1.2.2.1.1')
mac = []
for item in system_items:
mac.append(':'.join('{:02x}'.format(ord(x)) for x in item.value))
session = Session(hostname=host, community='ttlwifi', version=2)
SSGMAC,WLCip,SCGAPName,SCGAPNumSta,SCGAPConnStatus = (list(session.bulkwalk('1.3.6.1.4.1.25053.1.3.2.1.1.2.2.1.' + c ,non_repeaters=0, max_repetitions=50)) for c in ('1','10','5','15','16'))
for i in range(len(WLCip)):
print ('{} {} {} {} {} {}'.format(host,WLCip[i].value,mac[0],SCGAPName[i].value,SCGAPNumSta[i].value,SCGAPConnStatus[i].value)) Output: 10.124.115.10 10.138.69.54 04:4f:aa:34:a2:80 RuckusAP 6 Connect
10.124.115.10 10.138.69.75 04:4f:aa:34:a2:80 RuckusAP 8 Connect
10.124.115.10 10.138.69.40 04:4f:aa:34:a2:80 RuckusAP 4 Connect
10.124.115.10 10.138.64.173 04:4f:aa:34:a2:80 RuckusAP 12 Connect
10.124.115.10 10.138.64.172 04:4f:aa:34:a2:80 RuckusAP 5 Connect
10.124.115.10 10.138.69.8 04:4f:aa:34:a2:80 RuckusAP 5 Connect
10.124.115.10 10.138.69.55 04:4f:aa:34:a2:80 RuckusAP 2 Connect
10.124.115.10 10.138.69.74 04:4f:aa:34:a2:80 RuckusAP 18 Connect
10.124.115.10 10.138.69.102 04:4f:aa:34:a2:80 RuckusAP 9 Connect
print ('{} {} {} {} {} {}'.format(host,WLCip[i].value,mac[i],SCGAPName[i].value,SCGAPNumSta[i].value,SCGAPConnStatus[i].value)) some changes
|