On 29/01/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> ......   I've noticed that throughout
> net-snmp modules, there are calls to "snmp_log" which log messages to an
> error log somewhere,

By default, messages from the Net-SNMP agent will tend to be logged via
the 'syslog' mechanism.   You can control this by using the -Lx set of options.
See the snmpcmd(1) man page for details - under LOGGING OPTIONS.

When debugging, I typically run the agent using

      snmpd -f -Le .....

so that I can see any output immediately.




> As far as I can tell by rummaging through all of the documentation, when
> running snmpd -D [TOKEN], these snmp_log messages get outputed.

Not quite.
The -D{token} option is concerned with the DEBUGMSG* statements,
rather than the snmp_log() messages.

> the documentation isn't explicit regarding just exactly what a TOKEN is?
> Is it a *.c file? Is it a library name?

Neither - it's just a string.
When you specify -D{token}, the agent (or application) will log any message
where the first parameter to the DEBUGMSG* statement matches the
specified token.   Or strictly speaking, where the token is a "prefix match".

So for example,
     snmpd  -f  -Le  -Dperl
            would display any of the debug messages in agent/snmp_perl.c,
which are all of the form:
    agent/snmp_perl.c:    DEBUGMSGTL(("perl", {some message} ));

Note that again, I've used "-f -Le" to make sure that the debug output
is easily visible.


This token can be any string, and will display any matching debug
messages.    If you omit the token altogether, and just use the option -D
then this will turn on *ALL* the debugging output.   And there's a lot
of it!    You probably don't want to do that.
   Look for the DEBUG messages in the section of code that you are
interested in, and use the appropriate token from those statements
to activate that particular set of debugging information.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to