aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-10-11 17:53:37 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-10-11 17:53:37 +0300
commit57bc2c02b09c83cc4e22e9c0c199333cb5ad729b (patch)
treea6e9aa307b32409b00b5b72673a85cb33302bff8
parentfd49c1902f656e1cbb407c610764fd2b56ff1985 (diff)
downloadtallyman-57bc2c02b09c83cc4e22e9c0c199333cb5ad729b.tar.gz
tallyman-57bc2c02b09c83cc4e22e9c0c199333cb5ad729b.tar.bz2
Optional file for snmp client configuration.
* src/config.c (tallymand_kw): New statement "snmp-client-config". * src/stevedore.8: Document it. * src/stevedore.h (snmp_client_config_file): New extern. * src/subagent.c (snmp_client_config_file): New variable. (agentx_init): Fix logger configuration. Parse snmp_client_config_file, if it is supplied. Disable storing the persistent state configuration.
-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[] = {
194 { "hostproc-server", "host", 194 { "hostproc-server", "host",
195 "Sets hostname or IP address of the hostproc agent", 195 "Sets hostname or IP address of the hostproc agent",
196 grecs_type_string, GRECS_DFLT, &hostproc_server_addr }, 196 grecs_type_string, GRECS_DFLT, &hostproc_server_addr },
197 { "snmp-client-config", "file",
198 "The filename of the SNMP client configuration file containing"
199 " access credentials for hostproc-server",
200 grecs_type_string, GRECS_DFLT, &snmp_client_config_file },
197 { NULL } 201 { NULL }
198}; 202};
199 203
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 @@
1.TH STEVEDORE 8 "October 10, 2020" "TALLYMAN" "Tallyman User Reference" 1.TH STEVEDORE 8 "October 11, 2020" "TALLYMAN" "Tallyman User Reference"
2.SH NAME 2.SH NAME
3stevedore \- container state collector and SNMP agent daemon 3stevedore \- container state collector and SNMP agent daemon
4.SH SYNOPSIS 4.SH SYNOPSIS
@@ -123,10 +123,16 @@ using the following statement:
123This statement sets the hostname or IP address of the server running 123This statement sets the hostname or IP address of the server running
124\fBhostproc\fR. Optional port can be specified by following the 124\fBhostproc\fR. Optional port can be specified by following the
125argument with a colon and port number. 125argument with a colon and port number.
126.PP 126.TP
127SNMP credentials for the SET operation are taken from the standard 127.BI "snmp-client-config " FILE
128.B net\-snmp 128Sets the filename of the SNMP client configuration file for
129location. 129\fBhostproc\fR notification. The \fIFILE\fR should be in the
130same format as the
131.BR snmp.conf (5).
132.sp
133In the absense of this statement, the system-wide
134.B snmp.conf
135will be read.
130.SS Syslog configuration 136.SS Syslog configuration
131Unless the program is started in foreground mode (see the \fB\-F\fR 137Unless the program is started in foreground mode (see the \fB\-F\fR
132option), its logging output goes to syslog facility \fBdaemon\fR. The 138option), its logging output goes to syslog facility \fBdaemon\fR. The
@@ -246,6 +252,7 @@ Error message associated with this instance if \fBinstanceState\fR is
246.RE 252.RE
247.SH "SEE ALSO" 253.SH "SEE ALSO"
248.BR tallyman (1), 254.BR tallyman (1),
255.BR snmp.conf (5),
249.BR hostproc (8), 256.BR hostproc (8),
250or 257or
251.BR http://puszcza.gnu.org.ua/software/hostproc . 258.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;
23extern unsigned ttl_snmp_table_cache; 23extern unsigned ttl_snmp_table_cache;
24extern unsigned ttl_instance_state; 24extern unsigned ttl_instance_state;
25extern char *hostproc_server_addr; 25extern char *hostproc_server_addr;
26extern char *snmp_client_config_file;
26 27
27void config_help(void); 28void config_help(void);
28void readconfig(char const *file); 29void 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.
10#include "tallyman_mib.h" 10#include "tallyman_mib.h"
11#include <signal.h> 11#include <signal.h>
12 12
13char *snmp_client_config_file;
14
13void 15void
14agentx_init(void) 16agentx_init(void)
15{ 17{
16 if (grecs_log_to_stderr) 18 if (grecs_log_to_stderr) {
17 snmp_enable_calllog();
18 else
19 snmp_enable_stderrlog(); 19 snmp_enable_stderrlog();
20 } else {
21 snmp_enable_syslog_ident(progname, LOG_DAEMON);
22 snmp_disable_stderrlog();
23 }
20 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 24 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
21 NETSNMP_DS_AGENT_ROLE, 1); 25 NETSNMP_DS_AGENT_ROLE, 1);
26 if (snmp_client_config_file) {
27 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
28 NETSNMP_DS_LIB_DONT_READ_CONFIGS,
29 1);
30 }
22 SOCK_STARTUP; 31 SOCK_STARTUP;
23 init_agent("stevedore"); 32 init_agent("stevedore");
24 init_tallyman_mib(); 33 init_tallyman_mib();
25 init_snmp("stevedore"); 34 init_snmp("stevedore");
35 if (snmp_client_config_file) {
36 read_config_with_type(snmp_client_config_file, "snmp");
37 }
38 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
39 NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
26} 40}
27 41
28time_t start_time; 42time_t start_time;

Return to:

Send suggestions and report system problems to the System administrator.