Re: snmp error


#1

the mac address is visualized as shown

1.3.6.1.2.1.2.2.1.6.1 ýg OCTET STRING

instead of 0:10:83:fd:dd:67.

How can I fix it?

The trouble is that you are printing the raw 6 byte string (note that
hex 67
is the ASCII code for a lower-case ‘g’)

So you just need to convert it into 12 hex digits:

a = "\x00\x10\x83\xfd\xdd\x67"
puts a.unpack("H*").first

Here’s one way to add the colons:

a = "\x00\x10\x83\xfd\xdd\x67"
puts a.unpack("H2H2H2H2H2H2").join(":")