Subject: [Agentx] Help: building agentx

From: "Ivensky, Ellie" <[email-masked]>
Date: Mon, 2 Jun 2003 14:18:17 +0300

Hi,

I am trying to build AgentX extension which listens external events and
generates traps. For this I have written the function "my_function(<param
string>)", which for a now has the only functionality to add a line "<param
string>" to the log file each time this function was called.  

I used the code of example_daemon.c from
www.net-snmp.org/tutorial-5/toolkit/demon/example-demon.c , and tried to add
a call my_finction() by the following way:

int main() {

	<...>

	init_agent("example_daemon");

	init_nstAgentSubagentObject();

	my_function("from main");

	init_snmp("example_daemon");

	my_function("from main");

	signal(<...>);
	signal(<...>);

	my_function("from main");

	while(<...>) {

 	<...>

}

Additional call my_function() was from init_nstAgentSubagentObject(), which
added the line "from init_nstAgentSubagentObject" to the same log file.

This code was compiled and linked with net-snmp-5.0.1 libraries. My agent
was successfully registered at the master agent (output of snmpd -Dagentx -f
-L gave no error messages), but at the log file I had only one line "from
init_nstAgentSubagentObject" which was added from
init_nstAgentSubagentObject(), i.e. there were no calls of my_function()
from the main.
Running snmpwalk over MIB region of this extension was successful. 

Does anyone has explanation why there were no calls my_function() from main?

Thanks,
	Ellie.