forked from pool/monitoring-plugins
f8d9ee89c9
FIXES + Fix check_ntp's jitter checking + Fix check_ntp's handling of invalid server responses + Fix check_apt's handling of invalid regular expressions + Fix check_real's server response processing + Fix backslash escaping in check_tcp's --help output + Fix check_jabber to work with Openfire servers + Fix check_oracle bad string matching when testing TNS server + Fixed check_ifstatus performance data output + Fixed expire time output for sslutils + check_dns now verifies if the answer is returning from the queried server + Fix check_by_ssh to accept --hostname as argument ENHANCEMENTS + New check_hpjd -p option for port specification (abrist) + New ./configure --with-qmail-qstat-command option to specify the path to qmail-qstat(8) + New check_ifstatus -n option to ignore interfaces by name + check_ntp_peer has now specific state output for each metric + New check_mysql -n option to ignore authentication failures + Added IP and port or socket name to error messages + New check_ntp_time -o option to add expected offset + check_disk shows now troubled partions in verbose mode + check_dig has now support for drill and dig + check_dig has now support for -6 option + Add performance data to check_file_age - removed upstreamed patches: + monitoring-plugins-1.4.14-ntpd.patch + monitoring-plugins.check_ntp.c-64bit-portability-issue.patch OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=12
126 lines
4.9 KiB
Diff
126 lines
4.9 KiB
Diff
Index: monitoring-plugins-2.1.1/plugins/check_snmp.c
|
|
===================================================================
|
|
--- monitoring-plugins-2.1.1.orig/plugins/check_snmp.c
|
|
+++ monitoring-plugins-2.1.1/plugins/check_snmp.c
|
|
@@ -104,6 +104,8 @@ int errcode, excode;
|
|
|
|
char *server_address = NULL;
|
|
char *community = NULL;
|
|
+char **context = NULL;
|
|
+char *v3context = NULL;
|
|
char **authpriv = NULL;
|
|
char *proto = NULL;
|
|
char *seclevel = NULL;
|
|
@@ -128,6 +130,7 @@ size_t nunits = 0;
|
|
size_t unitv_size = OID_COUNT_STEP;
|
|
int numoids = 0;
|
|
int numauthpriv = 0;
|
|
+int numcontext = 0;
|
|
int verbose = 0;
|
|
int usesnmpgetnext = FALSE;
|
|
char *warning_thresholds = NULL;
|
|
@@ -297,8 +300,8 @@ main (int argc, char **argv)
|
|
snmpcmd = strdup (PATH_TO_SNMPGET);
|
|
}
|
|
|
|
- /* 10 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */
|
|
- command_line = calloc (10 + numauthpriv + 1 + numoids + 1, sizeof (char *));
|
|
+ /* 10 arguments to pass before context and authpriv options + 1 for host and numoids. Add one for terminating NULL */
|
|
+ command_line = calloc (10 + numcontext + numauthpriv + 1 + numoids + 1, sizeof (char *));
|
|
command_line[0] = snmpcmd;
|
|
command_line[1] = strdup ("-Le");
|
|
command_line[2] = strdup ("-t");
|
|
@@ -310,23 +313,27 @@ main (int argc, char **argv)
|
|
command_line[8] = "-v";
|
|
command_line[9] = strdup (proto);
|
|
|
|
+ for (i = 0; i < numcontext; i++) {
|
|
+ command_line[10 + i] = context[i];
|
|
+ }
|
|
+
|
|
for (i = 0; i < numauthpriv; i++) {
|
|
- command_line[10 + i] = authpriv[i];
|
|
+ command_line[10 + numcontext + i] = authpriv[i];
|
|
}
|
|
|
|
- xasprintf (&command_line[10 + numauthpriv], "%s:%s", server_address, port);
|
|
+ xasprintf (&command_line[10 + numcontext + numauthpriv], "%s:%s", server_address, port);
|
|
|
|
/* This is just for display purposes, so it can remain a string */
|
|
- xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s:%s",
|
|
- snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]",
|
|
+ xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s %s:%s",
|
|
+ snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[context]", "[authpriv]",
|
|
server_address, port);
|
|
|
|
for (i = 0; i < numoids; i++) {
|
|
- command_line[10 + numauthpriv + 1 + i] = oids[i];
|
|
+ command_line[10 + numcontext + numauthpriv + 1 + i] = oids[i];
|
|
xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]);
|
|
}
|
|
|
|
- command_line[10 + numauthpriv + 1 + numoids] = NULL;
|
|
+ command_line[10 + numcontext + numauthpriv + 1 + numoids] = NULL;
|
|
|
|
if (verbose)
|
|
printf ("%s\n", cl_hidden_auth);
|
|
@@ -646,6 +653,7 @@ process_arguments (int argc, char **argv
|
|
{"retries", required_argument, 0, 'e'},
|
|
{"miblist", required_argument, 0, 'm'},
|
|
{"protocol", required_argument, 0, 'P'},
|
|
+ {"context", required_argument, 0, 'N'},
|
|
{"seclevel", required_argument, 0, 'L'},
|
|
{"secname", required_argument, 0, 'U'},
|
|
{"authproto", required_argument, 0, 'a'},
|
|
@@ -675,7 +683,7 @@ process_arguments (int argc, char **argv
|
|
}
|
|
|
|
while (1) {
|
|
- c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:x:A:X:",
|
|
+ c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
|
|
longopts, &option);
|
|
|
|
if (c == -1 || c == EOF)
|
|
@@ -713,6 +721,9 @@ process_arguments (int argc, char **argv
|
|
case 'P': /* SNMP protocol version */
|
|
proto = optarg;
|
|
break;
|
|
+ case 'N': /* SNMPv3 context */
|
|
+ v3context = optarg;
|
|
+ break;
|
|
case 'L': /* security level */
|
|
seclevel = optarg;
|
|
break;
|
|
@@ -960,6 +971,13 @@ validate_arguments ()
|
|
authpriv[1] = strdup (community);
|
|
}
|
|
else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */
|
|
+ if (!(v3context == NULL)) {
|
|
+ numcontext = 2;
|
|
+ context = calloc (numcontext, sizeof (char *));
|
|
+ context[0] = strdup ("-n");
|
|
+ context[1] = strdup (v3context);
|
|
+ }
|
|
+
|
|
if (seclevel == NULL)
|
|
xasprintf(&seclevel, "noAuthNoPriv");
|
|
|
|
@@ -1103,6 +1121,8 @@ print_help (void)
|
|
printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET"));
|
|
printf (" %s\n", "-P, --protocol=[1|2c|3]");
|
|
printf (" %s\n", _("SNMP protocol version"));
|
|
+ printf (" %s\n", "-N, --context=CONTEXT");
|
|
+ printf (" %s\n", _("SNMPv3 context"));
|
|
printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
|
|
printf (" %s\n", _("SNMPv3 securityLevel"));
|
|
printf (" %s\n", "-a, --authproto=[MD5|SHA]");
|
|
@@ -1210,6 +1230,6 @@ print_usage (void)
|
|
printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname);
|
|
printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
|
|
printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
|
|
- printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n");
|
|
- printf ("[-A authpasswd] [-x privproto] [-X privpasswd]\n");
|
|
+ printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n");
|
|
+ printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]\n");
|
|
}
|