Closed dr-dimitru closed 8 years ago
snmpwalk is being smart here, as the returned data is an octet-string with the (binary) contents c8 60 00 df 08 61
(the MAC address), which you see in the valueRaw and valueHex fields. You probably want to use one of those directly.
Not a problem at all with:
valueHex.match(/.{1,2}/g).join(':');
But it just doesn't seems right, as it exactly return a string: IF-MIB::ifPhysAddress.2 = STRING: c8:60:0:df:8:61
It doesn't, snmpwalk is simplifying things for you. The actual type returned according the MIB is a PhysAddress
:
PhysAddress ::=
OCTET STRING
-- This data type is used to model media addresses. For many
-- types of media, this will be in a binary representation.
-- For example, an ethernet address would be represented as
-- a string of 6 octets.
The actual octet string returned is not "c8:60:0:df:8:61"
, it is the six bytes c8 60 00 df 08 61
.
@calmh Thank you for explanation, appreciated.
Expected:
c8:60:0:df:8:61
Got:Response from
snmpwalk
:Code:
Or am I doing something wrong?