Try this:
Replace setup_log()
with the following:
snmp_disable_stderrlog();
snmp_enable_filelog("/var/log/subagent.log", 0);
Sorry, it was my mistake. I have defined setup_log() in my software. It
is not part of Net-SNMP package. That is why you are getting
the linker error.
Anand
Ste
On Thu, 4 Aug 2005 15:44:09 -0700 (PDT) Steve wrote:
SSL> In my sub-agent program, I have snmp_enable_calllog() and
SSL> several snmp_log()calls but nothing is being logged in
SSL> /var/log/snmpd.log file (default?). I thought
SSL> snmpd.log is only for AgentX master agent and not for
SSL> sub-agen
Thanks
Compile OK now. I still have link error:
"undefined reference to `setup_log'".
Here is what my Makefile looks like:
BUILDAGENTLIBS=`net-snmp-config --agent-libs`
sub-agent: $(OBJ)
$(CC) -o sub-agent $(OBJ) $(BUILDAGENTLIBS)
Am I missing some library in order to use setup_log?
Replace SUBAGENT_LOGFILE with "/var/log/subagent.log"
i.e.
logh->token = strdup("var/log/subagent.log");
Include the following net-snmp header files:
#include
#include
#include
Also define
netsnmp_log_handler *logh;
in your C program.
Anand
Steve S. Law wrote:
Hi,
Thanks for the info. I
Hi,
Thanks for the info. I added the lines to my sub-agent
code but it won't compile (error is: "undeclared
SUBAGENT-LOGFILE"). If I commented out that line, then
the link failed ("undefined reference to
`setup_log'").
What header file or/and library am I missing?
Thanks
Steve
Thillaivillagam" <[E
Put the following lines of code in your subagent program:
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE,
LOG_DEBUG);
if (logh)
{
logh->pri_max = LOG_EMERG;
logh->token = strdup(SUBAGENT_LOGFILE);
}
setup_log(0, /* 1=
In my sub-agent program, I have snmp_enable_calllog()
and
several snmp_log()calls but nothing is being logged in
/var/log/snmpd.log file (default?). I thought
snmpd.log is only for AgentX master agent and not for
sub-agent? Or even sub-agent will be logged to the
same file also? Clearly, I don't w
On Fri, 29 Jul 2005 15:07:11 -0700 (PDT) Steve wrote:
SSL> So far I have been using printf statements in my
SSL> sub-agent. I want to log them into a file instead, so
SSL> in the sub-agent main program, I set 'syslog' to 1
SSL> which invokes snmp_enable_callog(). However, when I
SSL> run it, I don'
Hi,
So far I have been using printf statements in my
sub-agent. I want to log them into a file instead, so
in the sub-agent main program, I set 'syslog' to 1
which invokes snmp_enable_callog(). However, when I
run it, I don't see any thing on the screean but I
don't know where and if anything is