|
Hi, I am using net-snmp with my application. Sub-agent is running with my application
and it is sending traps to master-agent. Before sending alarms I call
snmp_agent_init() function to initialize the net-snmp. My manager is not
receiving any alarms for first few seconds (4-5 seconds) after calling this
function, where send_deviceOperationalStateUpdate_trap() function returns success. Does snmp require some time to initialize? Following this mail is snmp_agent_init() function. Please help me to resolve this problem. Thanks & Regards, Gaurav void snmp_agent_init() { #endif int
agentx_subagent=1; /* change this if you want to be a SNMP master agent */ int
background = "" /* change this if you want to run in the background */ int
syslog = 0; /* change this if you want to use syslog */ /* print
log errors to syslog or stderr */ if
(syslog)
snmp_enable_calllog(); else
snmp_enable_stderrlog(); /* we're
an agentx subagent? */ if
(agentx_subagent) {
/* make us a agentx client. */
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE,
1); } /* run
in background, if requested */ if
(background && netsnmp_daemonize(1, !syslog)) exit(1); /*
initialize the agent library */
init_agent("myAgentX"); /*
initialize mib code here */ /*
myAgentX will be used to read myAgentX.conf files. */
init_snmp("myAgentX"); /* If
we're going to be a snmp master agent, initial the ports */ if
(!agentx_subagent)
init_master_agent(); /*
open the port to listen on (defaults to udp:161) */
snmp_log(LOG_INFO,"myAgentX is up and running.\n"); } Regards, Gaurav |
