I do this at the beginning of the process.
my code is like this:
MonitoringStatus
initSnmp()
{
// Sub-agentX
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE,
1);
netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_NO_ROOT_ACCESS);
ConfigParameters& param = configMonitoring_.getConfigParam();
// Set the Socket used to communicate with the master agent
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_X_SOCKET,
param.agentXSocket.c_str());
// Set the Community
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_LIB_COMMUNITY,
param.community.c_str());
// Don't persist
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_LIB_MIBDIRS,
param.pathMIB.c_str());
SOCK_STARTUP;
MonitoringStatus ret;
// initialize the agent library
if ( init_agent( appName_.c_str() ) != 0 )
{
return InitAgentFailure;
}
init_snmp( appName_.c_str() );
...
}
=> So I do this before init_agent and init_snmp (which seems to be
responsible to parse all the mibs)
>From: "Dave Shield" <[EMAIL PROTECTED]>
>To: "Arnaud BODENAN" <[EMAIL PROTECTED]>
>CC: [email protected]
>Subject: Re: Subagentx : how to define the path where MIBS are installed
>Date: Wed, 11 Oct 2006 13:09:51 +0100
>
>On 11/10/06, Arnaud BODENAN <[EMAIL PROTECTED]> wrote:
> > I create a subagentX and I set the Path for the MIBS using:
> > netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_LIB_MIBDIRS,
> > "/home/arnboden/snmp/mibs");
>
>Whereabouts in your code do you do this?
>In particular, where does this come in relation to the main initialisation
>code?
>
>
>
> > Is it possible to dynimacally change the directory where the mibs are
> > installed?
>
>Yes - but this must be done before the MIB files are read in. (Fairly
>obviously!)
>Once the MIBs have been loaded, changing the MIB directory won't have
>any effect.
>
>Dave
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job
>easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>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
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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