Hello!
I would like to change subagent settings in runtime, for example by HUP
signal.
Settings are MasterAgent address, port and subagent ping interval.
I tried:
int main()
{
...
init_agent("example-demon");
init_snmp("example-demon");
...
}
void OnHupSignal() /*just an example, not real code*/
{
/* CLOSE CONNECTION */
snmp_shutdown("example-demon");
/* CHANGE SETTINGS */
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET,
address.c_str());
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, interval);
/* INIT AGAIN */
init_agent("example-demon");
init_snmp("example-demon");
}
reconnection is done by init_snmp function(). But that function can be run
once only, see below:
void
init_snmp(const char *type)
{
static int done_init = 0; /* To prevent double init's. */
if (done_init) {
return;
}
done_init = 1;
...
Is it possible to reconnect to MasterAgent in another way (without help of
exec(), fork() and etc.)? How to change settings correctly?
Thanks in advance.
--
/BR, Alexander
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users