The Ruby SNMP library isn't as smart as Net-SNMP at formating output
because it doesn't have any knowledge of the underlying MIB. The
actual format of the MAC address is just 6 bytes (octets) representing
each digit of the MAC. Try vb.value.inspect to see what I mean. You
need to do your own translation.
Try this instead of vb.value.to_s:
vb.value.unpack("H2H2H2H2H2H2").join(":")
You could even add a to_mac method to the OctetString class
(untested).
module SNMP
class OctetString
def to_mac
raise "Invalid MAC" unless self.length == 6
self.unpack("H2H2H2H2H2H2").join(":")
end
end
end
Hope that helps.
Cheers,
Dave
···
On Jun 25, 7:18 am, jc <jack.ciaba...@gmail.com> wrote:
Hi,
I'm using SNMP module into a simple script. I would like retrieve
interfaces MAC
addresses by using oid "1.3.6.1.2.1.2.2.1.6" :