Unicode Symbols insted of mac

Hi
I’m writing a check which should contain a Mac address. However, the output is already shown wrong in the inventory function. The data is displayed correctly in the snmpwalk.
The Mac has the format “xx xx xx xx xx xx”

Hey @Maxi, can you post an example of how the output is shown wrong?

I’m working on an snmp check currently (ISIS-MIB) which you’ll see a post in this forum. I had to convert some ascii hex values, this might be what you need to do also.

Cheers,
Curtis

Sounds like the same problem.
This is the output in the Frontend
Accesspoint: online ( kñÌw€)
Accesspoint: online ( ,3#—¨)
Accesspoint: online ( ,3#¼)

best regards
maxi

Hi Maxi,

I was experimenting with the different formats available as I was learning how to convert, so below is binary, hex and decimal outputs. The main functions are .join, .format, and ord() and you can use different sepearators as I did below with space ’ ', colon ‘:’ and dot ‘.’ as I did in the example below.

z = ' kñÌw€'

print('z:' + z)
print('zlen:' + str(len(z)))

zbin = ' '.join('{:08b}'.format(ord(x), 'b') for x in z)
print('zbin:' + zbin)

zhex = ':'.join('{:02x}'.format(ord(x), 'x') for x in z)
print('zhex:' + zhex)

zdec = '.'.join(format(ord(x), 'd') for x in z)
print('zdec:' + zdec)

z: kñÌw
zlen:6
zbin:00100000 01101011 11110001 11001100 01110111 10000000
zhex:20:6b:f1:cc:77:80
zdec:32.107.241.204.119.128

Hope this helps!

Curtis

1 Like

Perfekt Solution.
Works like a charm