Facing a strange issue with the pysnmp agent return value.
PYSNMP Agent receives the string format as "0a0a0a0a0a0a0a0a0a"
.
In the MIB, OID is represented as HEXA STRING.
When tried to return the string using rfc1902.OctetString(hexValue=str_temp)
, the output is blank because the hexavalue (0a0a0a)
is decoded as new lines(\n)
characters.
SNMPv2-SMI::example.154.12.1.0 = STRING: "
"
str="0a0a0a0a0a0a0a0a"
After Return using rfc1902.OctetString(str) or rfc1902.OctetString(hexaValue=str)
Excepted Output:
SNMPv2-SMI::example.154.12.1.0 = Hex-STRING: 0A 0A 0A 0A 0A 0A 0A 0A
Can some one help me, how to decode or send the raw output to hexa string to get desired output as mentioned above.
for oid, val in varBinds:
print(oid.prettyPrint(),' = ',val.prettyPrint())