15.6. Debugging

Thanks to the DEBUGMSGTL macros, we have dropped in our MIB extension as we wrote it, and we are all set to trace the flow of control in our agent, should this become necessary. Just shut down the agent running in the background

/etc/rc.d/init.d/snmpd  stop

and run your own copy from the command line:

/opt/snmp/sbin/snmpd -D "LAD" -Le -f  -c /opt/snmp/etc/snmp/snmpd.conf -C

The -c <path to config file> -C is from the normal command string to run the agent. We discussed this in Chapter 14. What's new are the first three options.

The -D "LAD" activates our DEBUGMSGTL statements, which specified "LAD". Here's one taken from the code we discussed above:

DEBUGMSGTL(("LAD", "reading ladAlarmState\n"));

The -Le tells the agent to send ...

Get Linux Appliance Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.