Hi,
Following code is
the snippet of our SNMP SubAgent. I am facing two problems with this
finction.
1.
init_agentx_config() is deifined in agentx_config.c and the declaration is
available in agentx_config.h file. agentx_config.h is not getting copied
into the installed area when NET-SNMP is installed. So the include path
needs to be mentioned in the make of the subagent. Is there any reason,
for not copying this file into intall (/usr/include) area? Is there any
other alternative for this?
2.
init_agentx_config() registers the handlers for agentxSocket, agentxTimeout and
agentxRetryCount, but not for the agentxPingInterval. So, I registered the
tag and handler for the agentxPingInterval in the following function. But
this ping interval is getting overwritten to default value of 15 seconds.
I observed this only with the NET-SNMP-5.1.1 realease only. Is there any
alternative for this?
3. Is the
order of the calls that I am making in the init routine are correct? Am I
making necessary and sufficient calls to initialize the subagent?
init_subagent()
{
/*
make us a agentx client. */
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_ROLE, 1);
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_ROLE, 1);
/* set the type of the application */
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_APPTYPE,
"SnmpSubagt");
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_APPTYPE,
"SnmpSubagt");
/* initiliaze the function pointers to parse the agentx
* configuration paramters
*/
init_agentx_config();
/* initialize the agentxPingInterval handler */
snmpd_register_config_handler("agentxPingInterval",
snmpsubagt_netsnmp_agentx_pingInterval,
* configuration paramters
*/
init_agentx_config();
/* initialize the agentxPingInterval handler */
snmpd_register_config_handler("agentxPingInterval",
snmpsubagt_netsnmp_agentx_pingInterval,
NULL, "Agentx Ping Interval (seconds)");
init_snmp("SnmpSubagt");
m_SNMPSUBAGT_HEADLINE_LOG(INIT_SNMP_DONE);
m_SNMPSUBAGT_HEADLINE_LOG(INIT_SNMP_DONE);
/* initialize the agent library */
/* This function initializes the session with the Agent */
init_agent("SnmpSubagt");
/* This function initializes the session with the Agent */
init_agent("SnmpSubagt");
}
static
void
snmpsubagt_netsnmp_agentx_pingInterval(const char *token, char *cptr)
{
int x = atoi(cptr);
/* log the function entry */
m_SNMPSUBAGT_FUNC_ENTRY_LOG(SNMPSUBAGT_FUNC_ENTRY_PING_INT_CONF);
DEBUGMSGTL(("agentx/config/PingInterval", "%s\n", cptr));
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, x);
return;
}
snmpsubagt_netsnmp_agentx_pingInterval(const char *token, char *cptr)
{
int x = atoi(cptr);
/* log the function entry */
m_SNMPSUBAGT_FUNC_ENTRY_LOG(SNMPSUBAGT_FUNC_ENTRY_PING_INT_CONF);
DEBUGMSGTL(("agentx/config/PingInterval", "%s\n", cptr));
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, x);
return;
}
Please help me.
Thanks
Mahesh