Hello all,
My name is Ryan Dowell and I work on the SNMP agent for Fusion-io. I have been
experiencing some issues with using a configuration file for an agentx
subagent. I am finding that the separate configuration file for the subagent
seems to never be read when the subagent is started. The subagent
initialization is based on the example at
www.net-snmp.org/docs/man/snmp_agent_api.htm, and the .conf file name matches
that of the subagent executable(i.e. 'xxx_agent' and 'xxx_agent.conf'), and is
located in the /etc/snmp directory where the snmpd.conf and snmptrapd.conf
files are located. Inside the subagent code, I am attempting to initialize and
read the .conf file as follows:
Int main{int argc, char *argv)
{
...
Const char *agentName = basename(argv[0]);
...
Register_config_handler(agentName, token_XXX, configHandler, NULL, NULL);
Register_config_handler(agentName, token_YYY, configHandler, NULL, NULL);
...
Netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
...
Init_agent(agentName);
...
Init_snmp(agentName);
...
<main loop>
...
Snmp_shutdown(agentName);
}
Void configHandler(const char* token, char* value)
{
If (strcmp(token, token_XXX) == 0)
{
Config_XXX = ....
}
Else if (strcmp(token, token_YYY) = 0)
{
Config_YYY = ...
}
}
I have confirmed that the token names passed to register_config_handler and
used in configHandler match those in the subagent's .conf file and that the
.conf and executable share the same file name aside from the extension. What
I've found while debugging is that the configHandler function is never invoked,
so none of the config parameters we expect to read from the file are ever read
in, and they all keep their default values. The subagent runs completely
normally otherwise. Running snmpconf shows that net-snmp is only aware of
snmpd.conf and snmptrapd.conf. I would like to know if perhaps there is an
installation step we are missing to make sure net-snmp is aware of the
subagent's .conf file, or if there is a more direct way to make it read the
.conf file than the method of registering the callback and relying on
init_agent and init_snmp to find and read the file. Any insight or suggestions
would be greatly appreciated, as I have not seen anything else in the
documentation regarding use of a separate .conf file for a subagent.
Ryan Dowell
Software Engineer, Fusion-io
Superior, CO
[email protected]
Confidentiality Notice: This e-mail message, its contents and any attachments
to it are confidential to the intended recipient, and may contain information
that is privileged and/or exempt from disclosure under applicable law. If you
are not the intended recipient, please immediately notify the sender and
destroy the original e-mail message and any attachments (and any copies that
may have been made) from your system or otherwise. Any unauthorized use,
copying, disclosure or distribution of this information is strictly prohibited.
------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and
improve service delivery. Take 5 minutes to use this Systems Optimization
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
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