Debugging output

From Net-SNMP Wiki
Jump to: navigation, search

Net-SNMP applications and the agent support run-time selectable debugging output. The -D flag can be used to select tokens to display at runtime with a comma separated list. For example -Dtls,ssl,snmpd will display every debugging statement registered with the prefixes of "tls", "ssl" and "snmpd". This will include longer prefixes too such as "snmpd/main" and "sslctx_client" for example.


Command line options

Options for using -D for DEBUG output

-D token[,token[,token]...]

To see every possible output use

-D all

The token are not predefined but defined through usage.

DEBUGMSG(( token, format, ...))

To find all existing tokens in the source code, see the command on the debug tokens page.

Configuration files

Note that if you want to turn on debugging via the config file, but *only* for the agent (rather than all SNMP commands), then you'd need a block something like

   [snmp]
    doDebugging 1
    debugTokens  this,that,theother

in your snmpd.conf file (the leading [snmp] token indicates it's actually going to be directives from the main snmp.conf file; use "[snmpd]" to switch back to snmpd.conf tokens after that if you need to.)