summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/config.c4
-rw-r--r--src/stevedore.817
-rw-r--r--src/stevedore.h1
-rw-r--r--src/subagent.c20
4 files changed, 34 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c
index c076a15..012a096 100644
--- a/src/config.c
+++ b/src/config.c
@@ -194,6 +194,10 @@ static struct grecs_keyword tallymand_kw[] = {
{ "hostproc-server", "host",
"Sets hostname or IP address of the hostproc agent",
grecs_type_string, GRECS_DFLT, &hostproc_server_addr },
+ { "snmp-client-config", "file",
+ "The filename of the SNMP client configuration file containing"
+ " access credentials for hostproc-server",
+ grecs_type_string, GRECS_DFLT, &snmp_client_config_file },
{ NULL }
};
diff --git a/src/stevedore.8 b/src/stevedore.8
index 841123d..2b4e7e8 100644
--- a/src/stevedore.8
+++ b/src/stevedore.8
@@ -1,4 +1,4 @@
-.TH STEVEDORE 8 "October 10, 2020" "TALLYMAN" "Tallyman User Reference"
+.TH STEVEDORE 8 "October 11, 2020" "TALLYMAN" "Tallyman User Reference"
.SH NAME
stevedore \- container state collector and SNMP agent daemon
.SH SYNOPSIS
@@ -123,10 +123,16 @@ using the following statement:
This statement sets the hostname or IP address of the server running
\fBhostproc\fR. Optional port can be specified by following the
argument with a colon and port number.
-.PP
-SNMP credentials for the SET operation are taken from the standard
-.B net\-snmp
-location.
+.TP
+.BI "snmp-client-config " FILE
+Sets the filename of the SNMP client configuration file for
+\fBhostproc\fR notification. The \fIFILE\fR should be in the
+same format as the
+.BR snmp.conf (5).
+.sp
+In the absense of this statement, the system-wide
+.B snmp.conf
+will be read.
.SS Syslog configuration
Unless the program is started in foreground mode (see the \fB\-F\fR
option), its logging output goes to syslog facility \fBdaemon\fR. The
@@ -246,6 +252,7 @@ Error message associated with this instance if \fBinstanceState\fR is
.RE
.SH "SEE ALSO"
.BR tallyman (1),
+.BR snmp.conf (5),
.BR hostproc (8),
or
.BR http://puszcza.gnu.org.ua/software/hostproc .
diff --git a/src/stevedore.h b/src/stevedore.h
index 66432bb..12ebb75 100644
--- a/src/stevedore.h
+++ b/src/stevedore.h
@@ -23,6 +23,7 @@ extern char *runas_group;
extern unsigned ttl_snmp_table_cache;
extern unsigned ttl_instance_state;
extern char *hostproc_server_addr;
+extern char *snmp_client_config_file;
void config_help(void);
void readconfig(char const *file);
diff --git a/src/subagent.c b/src/subagent.c
index 6213cba..522c520 100644
--- a/src/subagent.c
+++ b/src/subagent.c
@@ -10,19 +10,33 @@ There is NO WARRANTY, to the extent permitted by law.
#include "tallyman_mib.h"
#include <signal.h>
+char *snmp_client_config_file;
+
void
agentx_init(void)
{
- if (grecs_log_to_stderr)
- snmp_enable_calllog();
- else
+ if (grecs_log_to_stderr) {
snmp_enable_stderrlog();
+ } else {
+ snmp_enable_syslog_ident(progname, LOG_DAEMON);
+ snmp_disable_stderrlog();
+ }
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_ROLE, 1);
+ if (snmp_client_config_file) {
+ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_DONT_READ_CONFIGS,
+ 1);
+ }
SOCK_STARTUP;
init_agent("stevedore");
init_tallyman_mib();
init_snmp("stevedore");
+ if (snmp_client_config_file) {
+ read_config_with_type(snmp_client_config_file, "snmp");
+ }
+ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
}
time_t start_time;

Return to:

Send suggestions and report system problems to the System administrator.