Discussion:
snmpget won't return correct value of string, tcpdump show correct
Streuli Arno
2017-02-27 14:53:30 UTC
Permalink
I have a strange things with snmpget, I'm doing the following request: (it's request to have the ip address on Cisco switch of CDP neighbor )
[***@lslcact01:~] # snmpget -v2c -cXXXXX se-sve-225 .1.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10108.3 = STRING: "
UyC"


So the answer is not correct, but if I look on the tcpdump it is:

Frame 2: 98 bytes on wire (784 bits), 98 bytes captured (784 bits)
Ethernet II, Src: Cisco_ff:fc:28 (00:08:e3:ff:fc:28), Dst: Vmware_a0:3d:8a (00:50:56:a0:3d:8a)
Internet Protocol Version 4, Src: 10.85.0.225, Dst: 10.128.1.12
User Datagram Protocol, Src Port: 161, Dst Port: 55051
Simple Network Management Protocol
version: v2c (1)
community: telvlsn
data: get-response (2)
get-response
request-id: 56909846
error-status: noError (0)
error-index: 0
variable-bindings: 1 item
1.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3: 0a557943
Object Name: 1.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3 (iso.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3)
Value (OctetString): 0a557943


And if i do a snmpwalk like that:
[***@lslcact01:~] # snmpwalk -v2c -cXXXXX se-sve-225 .1.3.6.1.4.1.9.9.23.1.2.1.1.4
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10108.3 = STRING: "
UyC"
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10109.2 = Hex-STRING: 0A 55 00 E0
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10110.1 = Hex-STRING: 0A 55 00 01

As you can see only the first value is wrong, the following are correct !
I'm running net.snmp 5.7.2 on CentOS 3.10.0-514.2.2.el7.x86_64

Arno
Fulko Hew
2017-02-27 15:41:20 UTC
Permalink
(it’s request to have the ip address on Cisco switch of CDP neighbor )
.1.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10108.3 = STRING: "
UyC"
Frame 2: 98 bytes on wire (784 bits), 98 bytes captured (784 bits)
Ethernet II, Src: Cisco_ff:fc:28 (00:08:e3:ff:fc:28), Dst: Vmware_a0:3d:8a
(00:50:56:a0:3d:8a)
Internet Protocol Version 4, Src: 10.85.0.225, Dst: 10.128.1.12
User Datagram Protocol, Src Port: 161, Dst Port: 55051
Simple Network Management Protocol
version: v2c (1)
community: telvlsn
data: get-response (2)
get-response
request-id: 56909846
error-status: noError (0)
error-index: 0
variable-bindings: 1 item
1.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3: 0a557943
Object Name: 1.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3
(iso.3.6.1.4.1.9.9.23.1.2.1.1.4.10108.3)
Value (OctetString): 0a557943
.1.3.6.1.4.1.9.9.23.1.2.1.1.4
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10108.3 = STRING: "
UyC"
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10109.2 = Hex-STRING: 0A 55 00 E0
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10110.1 = Hex-STRING: 0A 55 00 01
As you can see only the first value is wrong, the following are correct !
I’m running net.snmp 5.7.2 on CentOS 3.10.0-514.2.2.el7.x86_64
​I don't see anything wrong.
The first variable is shown as a printable string and the other two
variables are shown as their corresponding hex values.

That's probably occurring because the first value is completly
printable, so its shown as the string, but the other two values
contain unprintable characters, so they are shown as their hex
equivalents instead.

If you want strings shown in hex, try the -Ox option on your commands.

​

Loading...