diff --git a/smmapdfw/Makefile.am b/smmapdfw/Makefile.am index 45a920d..8c40295 100644 --- a/smmapdfw/Makefile.am +++ b/smmapdfw/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS = libsmmapdfw smmapd verify_worker test_worker cyrus_worker doc -EXTRA_DIST = m4/*.m4 +EXTRA_DIST = m4/*.m4 mib/*.txt diff --git a/smmapdfw/Makefile.in b/smmapdfw/Makefile.in index ea01fc9..e8abe1e 100644 --- a/smmapdfw/Makefile.in +++ b/smmapdfw/Makefile.in @@ -88,7 +88,7 @@ STRIP = @STRIP@ VERSION = @VERSION@ SUBDIRS = libsmmapdfw smmapd verify_worker test_worker cyrus_worker doc -EXTRA_DIST = m4/*.m4 +EXTRA_DIST = m4/*.m4 mib/*.txt ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h @@ -280,7 +280,7 @@ distdir: $(DISTFILES) distdir=`cd $(distdir) && pwd`; \ cd $(top_srcdir) \ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile - $(mkinstalldirs) $(distdir)/m4 + $(mkinstalldirs) $(distdir)/m4 $(distdir)/mib @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ diff --git a/smmapdfw/smmapd/smmapd.c b/smmapdfw/smmapd/smmapd.c index 70e4c33..7439083 100644 --- a/smmapdfw/smmapd/smmapd.c +++ b/smmapdfw/smmapd/smmapd.c @@ -122,7 +122,7 @@ void * statser(void * arg) { #if ENABLE_NETSNMP==1 void * snmper(void * arg) { - snmp_subagent_main(); + snmp_subagent_main(cfg); } #endif diff --git a/smmapdfw/smmapd/snmp_subagent.c b/smmapdfw/smmapd/snmp_subagent.c index 15d94e6..58b97d1 100644 --- a/smmapdfw/smmapd/snmp_subagent.c +++ b/smmapdfw/smmapd/snmp_subagent.c @@ -31,7 +31,7 @@ #include "stats.h" #include "smmapd.h" - +#include "cfg.h" typedef struct var_cnt_map_s { char* var; @@ -45,6 +45,9 @@ int integer32 = 1; var_cnt_map_t *var_cnt_map = NULL; int num_var_cnt_map = 0; +char *agentx_socket = NULL; + + int handle_number1(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, @@ -199,8 +202,12 @@ init_dhsMIBObjects(void) } -void snmp_subagent_main () { +void snmp_subagent_main(cfg_t *cfg) { snmp_enable_syslog_ident("smmapd", LOG_LOCAL2); + + agentx_socket = findcfgx(cfg, "snmp", "agentx_socket", "/var/agentx/master"); + netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, agentx_socket); + netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); init_agent("smmapd_subagent"); init_dhsMIBObjects(); diff --git a/smmapdfw/smmapd/snmp_subagent.h b/smmapdfw/smmapd/snmp_subagent.h index edbe8ed..c5ef704 100644 --- a/smmapdfw/smmapd/snmp_subagent.h +++ b/smmapdfw/smmapd/snmp_subagent.h @@ -24,9 +24,10 @@ #define _SNMP_SUBAGENT_H_ #include "config.h" +#include "cfg.h" #if ENABLE_NETSNMP==1 -void snmp_subagent_main(); +void snmp_subagent_main(cfg_t *cfg); #endif #endif /* _SNMP_SUBAGENT_H_ */