Printable Characters and Hexadecimal Output from the tools

From Net-SNMP Wiki
Jump to: navigation, search
Good Answer

This is a Good Answer article. It was likely created as a response to a question on a Net-SNMP Mailing List and written up here for others to see. It likely covers material not yet in the FAQ or in the Tutorial but may someday be moved there


When I do an snmp walk on part of the mib space, some objects that normally return a string type are instead returning hexadecimal characters, yet they identify the oid type as string instead of hex string.


SNMP only has one type of data for strings, OCTET STRINGs is the SMI data type for sending strings through the SNMP protocol. It's Net-SNMP that decides whether to print a string as a human-formatted string or a hexadecimal string. And, in turn, Net-SNMP leaves that decision up to the system.

Making Strings Human Readable

The Net-SNMP tools all decide whether or not to print a character in a string directly to the output stream based on whether that character passes the system's isprint() test. Specifically, this means that whether or not the tools decide a character is printable is determined by your locale settings and what your default language is.

If you are seeing hexadecimal strings when you would like to see human-readable strings, you need to identify which characters are causing the issue and convince your system that they are printable.

Forcing Hexadecimal Display

hmm... how come the -Ox and -Oa options aren't working?

Possible answer: -Ox and -Oa do not override the DISPLAY-HINT if there is one. Try adding -Ih which disables the use of DISPLAY-HINT information: Quester (talk)