You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I issue a walk using a Session, I get the following output:
<SNMPVariable value='"'}" (contains binary)' (oid='.1.3.6.1.2.1.3.1.1.2.10.1.10.9.151', oid_index='139', snmp_type='OCTETSTR')>
Running an SNMPWALK against the same OID produces the following:
snmpwalk -v2c -c <community_string> <ip_address> .1.3.6.1.2.1.3.1.1.2.10
SNMPv2-SMI::mib-2.3.1.1.2.10.1.10.9.151.139 = STRING: "?'???}"
I can produce the desired result by adding the -Ox flag to my snmpwalk call:
snmpwalk -Ox -v2c -c <community_string> <ip_address> .1.3.6.1.2.1.3.1.1.2.10
SNMPv2-SMI::mib-2.3.1.1.2.10.1.10.9.151.139 = Hex-STRING: B8 27 EB EF C8 7D
Is there a way that I can add a similar flag to my Session instance?
The text was updated successfully, but these errors were encountered:
I found a way around it, but it doesn ‘t seem like the use_sprint_value works for a SNMPWalk, even though it’s coded to do so in the C library.
To fix, set use_sprint_value to false, and if your return contains binary (usually for MAC addresses), run the return through a function like this:
def mac_bin_to_hex(inc_bin_mac_address):
octets = [ord(c) for c in inc_bin_mac_address]
return "{:02X}:{:02X}:{:02X}:{:02X}:{:02X}:{:02X}".format(*octets)
This works for me. It’s not as elegant as fixing the library, but C is not my strong suit.
When I issue a walk using a Session, I get the following output:
<SNMPVariable value='"'}" (contains binary)' (oid='.1.3.6.1.2.1.3.1.1.2.10.1.10.9.151', oid_index='139', snmp_type='OCTETSTR')>
Running an SNMPWALK against the same OID produces the following:
snmpwalk -v2c -c <community_string> <ip_address> .1.3.6.1.2.1.3.1.1.2.10
SNMPv2-SMI::mib-2.3.1.1.2.10.1.10.9.151.139 = STRING: "?'???}"
I can produce the desired result by adding the -Ox flag to my snmpwalk call:
snmpwalk -Ox -v2c -c <community_string> <ip_address> .1.3.6.1.2.1.3.1.1.2.10
SNMPv2-SMI::mib-2.3.1.1.2.10.1.10.9.151.139 = Hex-STRING: B8 27 EB EF C8 7D
Is there a way that I can add a similar flag to my Session instance?
The text was updated successfully, but these errors were encountered: