Hope this will help "
/*calling a set snmpset to reload the snmpd.conf file , set
UCD-SNMP-MIB::versionUpdateConfig.0 will reload the agent with new settings*/
--- On Wed, 2/4/09, Alexander Bubnov <[email protected]> wrote:
From: Alexander Bubnov <[email protected]>
Subject: Re: how to do reconnection by subagent in code?
To: [email protected]
Date: Wednesday, February 4, 2009, 2:38 PM
I noticed if I change MasterAgent address with help of
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET,...)
function then the new address is used in case connection is broken between
master- and sub- agents.
So, in order to change master address there is a need to set a new address and
break the connection.
Question: how to break connection in code, with help of net-snmp library
functions to apply a new address?
snmp_shutdown(...) is not right function because it shutdowns subagent forever,
as I understand. But I would like to break connection for a few milliseconds.
2009/2/2 Alexander Bubnov <[email protected]>
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
--
/BR, Alexander
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications
today-http://p.sf.net/sfu/adobe-com_______________________________________________
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
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
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