From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/26654-snmpv3.dif | 167 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 web/attachments/26654-snmpv3.dif (limited to 'web/attachments/26654-snmpv3.dif') diff --git a/web/attachments/26654-snmpv3.dif b/web/attachments/26654-snmpv3.dif new file mode 100644 index 0000000..d4d9ecb --- /dev/null +++ b/web/attachments/26654-snmpv3.dif @@ -0,0 +1,167 @@ +--- plugins/check_snmp.c.orig Thu Feb 28 07:42:59 2002 ++++ plugins/check_snmp.c Tue Jul 9 11:48:10 2002 +@@ -97,6 +97,12 @@ + char oid[MAX_INPUT_BUFFER] = ""; + char *label = NULL; + char *units = NULL; ++char *secname = NULL; ++char *seclevel = NULL; ++char *authproto = NULL; ++char *authpasswd = NULL; ++char *privpasswd = NULL; ++int proto = 1; + char string_value[MAX_INPUT_BUFFER] = ""; + char **labels = NULL; + char **unitv = NULL; +@@ -143,10 +149,35 @@ + usage ("Incorrect arguments supplied\n"); + + /* create the command line to execute */ +- command_line = ssprintf ++ if (proto == 3) { ++ if ( strcmp(seclevel, "noAuthNoPriv") == 0 ) { ++ command_line = ssprintf ++ (command_line, ++ "%s -m ALL -v 3 -l noAuthNoPriv %s %s", ++ PATH_TO_SNMPGET, server_address, oid); ++ } ++ if ( strcmp(seclevel, "authNoPriv") == 0 ) { ++ command_line = ssprintf ++ (command_line, ++ "%s -m ALL -v 3 -l authNoPriv -a %s -u %s -A %s %s %s", ++ PATH_TO_SNMPGET, authproto, secname, authpasswd, ++ server_address, oid); ++ } ++ if ( strcmp(seclevel, "authPriv") == 0 ) { ++ command_line = ssprintf ++ (command_line, ++ "%s -m ALL -v 3 -l authPriv -a %s -u %s -A %s -X %s %s %s", ++ PATH_TO_SNMPGET, authproto, secname, authpasswd, ++ privpasswd, server_address, oid); ++ } ++ } else { ++ command_line = ssprintf + (command_line, + "%s -m ALL -v 1 %s %s %s", + PATH_TO_SNMPGET, server_address, community, oid); ++ } ++ ++ + + /* run the command */ + child_process = spopen (command_line); +@@ -285,7 +316,7 @@ + if (found == 0) + terminate + (STATE_UNKNOWN, +- "%s problem - No data recieved from host\nCMD: %s\n", ++ "%s problem - No data received from host\nCMD: %s\n", + label, command_line); + + /* WARNING if output found on stderr */ +@@ -348,6 +379,13 @@ + if (units == NULL) + units = strscpy (NULL, ""); + ++ if (seclevel == NULL || ( strcmp(seclevel, "authNoPriv") && ++ strcmp(seclevel, "authPriv") ) ) ++ seclevel = strscpy (NULL, "noAuthNoPriv"); ++ ++ if (authproto == NULL) ++ authproto = strscpy (NULL, "MD5"); ++ + return c; + } + +@@ -378,6 +416,12 @@ + {"eregi", required_argument, 0, 'R'}, + {"label", required_argument, 0, 'l'}, + {"units", required_argument, 0, 'u'}, ++ {"protocol", required_argument,0, 'p'}, ++ {"seclevel", required_argument,0, 'L'}, ++ {"authproto", required_argument,0, 'a'}, ++ {"authpasswd", required_argument,0, 'A'}, ++ {"privpasswd", required_argument,0, 'X'}, ++ {"secname", required_argument, 0, 'U'}, + {0, 0, 0, 0} + }; + #endif +@@ -385,10 +429,10 @@ + while (1) { + #ifdef HAVE_GETOPT_H + c = +- getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:", ++ getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:L:a:A:X:U:", + long_options, &option_index); + #else +- c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:"); ++ c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:L:a:A:X:U:"); + #endif + + if (c == -1 || c == EOF) +@@ -409,6 +453,12 @@ + case 'r': + case 'l': + case 'u': ++ case 'p': ++ case 'L': ++ case 'a': ++ case 'A': ++ case 'X': ++ case 'U': + i++; + } + +@@ -568,6 +618,24 @@ + unitv[nunits - 1] = ptr; + } + break; ++ case 'p': ++ proto = atoi(optarg); ++ break; ++ case 'L': ++ seclevel = strscpy (seclevel, optarg); ++ break; ++ case 'a': ++ authproto = strscpy (authproto, optarg); ++ break; ++ case 'A': ++ authpasswd = strscpy (authpasswd, optarg); ++ break; ++ case 'X': ++ privpasswd = strscpy (privpasswd, optarg); ++ break; ++ case 'U': ++ secname = strscpy (secname, optarg); ++ break; + } + } + return i; +@@ -580,6 +648,8 @@ + ("Usage: check_snmp -H -o [-w warn_range] [-c crit_range] \n" + " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n" + " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n" ++ " [-p protocol] [-L seclevel] [-a authproto] [-A authpasswd]\n" ++ " [-X privpasswd] [-U secname]\n" + " check_snmp --help\n" " check_snmp --version\n"); + } + +@@ -597,6 +667,18 @@ + " Print version information\n" + " -H, --hostname=HOST\n" + " Name or IP address of the device you wish to query\n" ++ " -p, --protocol=[1|3]\n" ++ " SNMP protocol version\n" ++ " -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n" ++ " SNMPv3 securityLevel\n" ++ " -U, --secname=USERNAME\n" ++ " SNMPv3 username\n" ++ " -a, --authproto=[MD5|SHA]\n" ++ " SNMPv3 authproto\n" ++ " -A, --authpasswd=PASSWORD\n" ++ " SNMPv3 authentication password\n" ++ " -X, --privpasswd=PASSWORD\n" ++ " SNMPv3 crypt password (DES)\n" + " -o, --oid=OID(s)\n" + " Object identifier(s) whose value you wish to query\n" + " -w, --warning=INTEGER_RANGE(s)\n" -- cgit v1.2.3-74-g34f1