summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c242
1 files changed, 186 insertions, 56 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 9839d6e..56a586a 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -1,31 +1,31 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Monitoring check_snmp plugin 3* Monitoring check_snmp plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999-2007 Monitoring Plugins Development Team 6* Copyright (c) 1999-2007 Monitoring Plugins Development Team
7* 7*
8* Description: 8* Description:
9* 9*
10* This file contains the check_snmp plugin 10* This file contains the check_snmp plugin
11* 11*
12* Check status of remote machines and obtain system information via SNMP 12* Check status of remote machines and obtain system information via SNMP
13* 13*
14* 14*
15* This program is free software: you can redistribute it and/or modify 15* This program is free software: you can redistribute it and/or modify
16* it under the terms of the GNU General Public License as published by 16* it under the terms of the GNU General Public License as published by
17* the Free Software Foundation, either version 3 of the License, or 17* the Free Software Foundation, either version 3 of the License, or
18* (at your option) any later version. 18* (at your option) any later version.
19* 19*
20* This program is distributed in the hope that it will be useful, 20* This program is distributed in the hope that it will be useful,
21* but WITHOUT ANY WARRANTY; without even the implied warranty of 21* but WITHOUT ANY WARRANTY; without even the implied warranty of
22* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23* GNU General Public License for more details. 23* GNU General Public License for more details.
24* 24*
25* You should have received a copy of the GNU General Public License 25* You should have received a copy of the GNU General Public License
26* along with this program. If not, see <http://www.gnu.org/licenses/>. 26* along with this program. If not, see <http://www.gnu.org/licenses/>.
27* 27*
28* 28*
29*****************************************************************************/ 29*****************************************************************************/
30 30
31const char *progname = "check_snmp"; 31const char *progname = "check_snmp";
@@ -46,6 +46,7 @@ const char *email = "devel@monitoring-plugins.org";
46#define DEFAULT_PRIV_PROTOCOL "DES" 46#define DEFAULT_PRIV_PROTOCOL "DES"
47#define DEFAULT_DELIMITER "=" 47#define DEFAULT_DELIMITER "="
48#define DEFAULT_OUTPUT_DELIMITER " " 48#define DEFAULT_OUTPUT_DELIMITER " "
49#define DEFAULT_BUFFER_SIZE 100
49 50
50#define mark(a) ((a)!=0?"*":"") 51#define mark(a) ((a)!=0?"*":"")
51 52
@@ -64,6 +65,7 @@ const char *email = "devel@monitoring-plugins.org";
64#define L_RATE_MULTIPLIER CHAR_MAX+2 65#define L_RATE_MULTIPLIER CHAR_MAX+2
65#define L_INVERT_SEARCH CHAR_MAX+3 66#define L_INVERT_SEARCH CHAR_MAX+3
66#define L_OFFSET CHAR_MAX+4 67#define L_OFFSET CHAR_MAX+4
68#define L_IGNORE_MIB_PARSING_ERRORS CHAR_MAX+5
67 69
68/* Gobble to string - stop incrementing c when c[0] match one of the 70/* Gobble to string - stop incrementing c when c[0] match one of the
69 * characters in s */ 71 * characters in s */
@@ -90,6 +92,7 @@ char *thisarg (char *str);
90char *nextarg (char *str); 92char *nextarg (char *str);
91void print_usage (void); 93void print_usage (void);
92void print_help (void); 94void print_help (void);
95char *multiply (char *str);
93 96
94#include "regex.h" 97#include "regex.h"
95char regex_expect[MAX_INPUT_BUFFER] = ""; 98char regex_expect[MAX_INPUT_BUFFER] = "";
@@ -113,6 +116,7 @@ char *authproto = NULL;
113char *privproto = NULL; 116char *privproto = NULL;
114char *authpasswd = NULL; 117char *authpasswd = NULL;
115char *privpasswd = NULL; 118char *privpasswd = NULL;
119int nulloid = STATE_UNKNOWN;
116char **oids = NULL; 120char **oids = NULL;
117size_t oids_size = 0; 121size_t oids_size = 0;
118char *label; 122char *label;
@@ -152,7 +156,12 @@ state_data *previous_state;
152double *previous_value; 156double *previous_value;
153size_t previous_size = OID_COUNT_STEP; 157size_t previous_size = OID_COUNT_STEP;
154int perf_labels = 1; 158int perf_labels = 1;
155 159char* ip_version = "";
160double multiplier = 1.0;
161char *fmtstr = "";
162bool fmtstr_set = false;
163char buffer[DEFAULT_BUFFER_SIZE];
164bool ignore_mib_parsing_errors = false;
156 165
157static char *fix_snmp_range(char *th) 166static char *fix_snmp_range(char *th)
158{ 167{
@@ -300,42 +309,55 @@ main (int argc, char **argv)
300 } 309 }
301 310
302 /* 10 arguments to pass before context and authpriv options + 1 for host and numoids. Add one for terminating NULL */ 311 /* 10 arguments to pass before context and authpriv options + 1 for host and numoids. Add one for terminating NULL */
303 command_line = calloc (10 + numcontext + numauthpriv + 1 + numoids + 1, sizeof (char *)); 312
304 command_line[0] = snmpcmd; 313 unsigned index = 0;
305 command_line[1] = strdup ("-Le"); 314 command_line = calloc (11 + numcontext + numauthpriv + 1 + numoids + 1, sizeof (char *));
306 command_line[2] = strdup ("-t"); 315
307 xasprintf (&command_line[3], "%d", timeout_interval); 316 command_line[index++] = snmpcmd;
308 command_line[4] = strdup ("-r"); 317 command_line[index++] = strdup ("-Le");
309 xasprintf (&command_line[5], "%d", retries); 318 command_line[index++] = strdup ("-t");
310 command_line[6] = strdup ("-m"); 319 xasprintf (&command_line[index++], "%d", timeout_interval);
311 command_line[7] = strdup (miblist); 320 command_line[index++] = strdup ("-r");
312 command_line[8] = "-v"; 321 xasprintf (&command_line[index++], "%d", retries);
313 command_line[9] = strdup (proto); 322 command_line[index++] = strdup ("-m");
323 command_line[index++] = strdup (miblist);
324 command_line[index++] = "-v";
325 command_line[index++] = strdup (proto);
326
327 xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s",
328 snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto);
329
330 if (ignore_mib_parsing_errors) {
331 command_line[index++] = "-Pe";
332 xasprintf(&cl_hidden_auth, "%s -Pe", cl_hidden_auth);
333 }
334
314 335
315 for (i = 0; i < numcontext; i++) { 336 for (i = 0; i < numcontext; i++) {
316 command_line[10 + i] = contextargs[i]; 337 command_line[index++] = contextargs[i];
317 } 338 }
318 339
319 for (i = 0; i < numauthpriv; i++) { 340 for (i = 0; i < numauthpriv; i++) {
320 command_line[10 + numcontext + i] = authpriv[i]; 341 command_line[index++] = authpriv[i];
321 } 342 }
322 343
323 xasprintf (&command_line[10 + numcontext + numauthpriv], "%s:%s", server_address, port); 344 xasprintf (&command_line[index++], "%s:%s", server_address, port);
324 345
325 /* This is just for display purposes, so it can remain a string */ 346 xasprintf(&cl_hidden_auth, "%s [context] [authpriv] %s:%s",
326 xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s %s:%s", 347 cl_hidden_auth,
327 snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[context]", "[authpriv]", 348 server_address,
328 server_address, port); 349 port);
329 350
330 for (i = 0; i < numoids; i++) { 351 for (i = 0; i < numoids; i++) {
331 command_line[10 + numcontext + numauthpriv + 1 + i] = oids[i]; 352 command_line[index++] = oids[i];
332 xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]); 353 xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]);
333 } 354 }
334 355
335 command_line[10 + numcontext + numauthpriv + 1 + numoids] = NULL; 356 command_line[index++] = NULL;
336 357
337 if (verbose) 358 if (verbose) {
338 printf ("%s\n", cl_hidden_auth); 359 printf ("%s\n", cl_hidden_auth);
360 }
339 361
340 /* Set signal handling and alarm */ 362 /* Set signal handling and alarm */
341 if (signal (SIGALRM, runcmd_timeout_alarm_handler) == SIG_ERR) { 363 if (signal (SIGALRM, runcmd_timeout_alarm_handler) == SIG_ERR) {
@@ -375,7 +397,7 @@ main (int argc, char **argv)
375 } 397 }
376 } 398 }
377 399
378 for (line=0, i=0; line < chld_out.lines; line++, i++) { 400 for (line=0, i=0; line < chld_out.lines && i < numoids ; line++, i++) {
379 if(calculate_rate) 401 if(calculate_rate)
380 conv = "%.10g"; 402 conv = "%.10g";
381 else 403 else
@@ -397,15 +419,15 @@ main (int argc, char **argv)
397 is_counter=0; 419 is_counter=0;
398 /* We strip out the datatype indicator for PHBs */ 420 /* We strip out the datatype indicator for PHBs */
399 if (strstr (response, "Gauge: ")) { 421 if (strstr (response, "Gauge: ")) {
400 show = strstr (response, "Gauge: ") + 7; 422 show = multiply (strstr (response, "Gauge: ") + 7);
401 } 423 }
402 else if (strstr (response, "Gauge32: ")) { 424 else if (strstr (response, "Gauge32: ")) {
403 show = strstr (response, "Gauge32: ") + 9; 425 show = multiply (strstr (response, "Gauge32: ") + 9);
404 } 426 }
405 else if (strstr (response, "Counter32: ")) { 427 else if (strstr (response, "Counter32: ")) {
406 show = strstr (response, "Counter32: ") + 11; 428 show = strstr (response, "Counter32: ") + 11;
407 is_counter=1; 429 is_counter=1;
408 if(!calculate_rate) 430 if(!calculate_rate)
409 strcpy(type, "c"); 431 strcpy(type, "c");
410 } 432 }
411 else if (strstr (response, "Counter64: ")) { 433 else if (strstr (response, "Counter64: ")) {
@@ -415,7 +437,11 @@ main (int argc, char **argv)
415 strcpy(type, "c"); 437 strcpy(type, "c");
416 } 438 }
417 else if (strstr (response, "INTEGER: ")) { 439 else if (strstr (response, "INTEGER: ")) {
418 show = strstr (response, "INTEGER: ") + 9; 440 show = multiply (strstr (response, "INTEGER: ") + 9);
441
442 if (fmtstr_set) {
443 conv = fmtstr;
444 }
419 } 445 }
420 else if (strstr (response, "OID: ")) { 446 else if (strstr (response, "OID: ")) {
421 show = strstr (response, "OID: ") + 5; 447 show = strstr (response, "OID: ") + 5;
@@ -468,9 +494,20 @@ main (int argc, char **argv)
468 /* Process this block for numeric comparisons */ 494 /* Process this block for numeric comparisons */
469 /* Make some special values,like Timeticks numeric only if a threshold is defined */ 495 /* Make some special values,like Timeticks numeric only if a threshold is defined */
470 if (thlds[i]->warning || thlds[i]->critical || calculate_rate) { 496 if (thlds[i]->warning || thlds[i]->critical || calculate_rate) {
497 if (verbose > 2) {
498 print_thresholds(" thresholds", thlds[i]);
499 }
471 ptr = strpbrk (show, "-0123456789"); 500 ptr = strpbrk (show, "-0123456789");
472 if (ptr == NULL) 501 if (ptr == NULL){
473 die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show); 502 if (nulloid == 3)
503 die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show);
504 else if (nulloid == 0)
505 die (STATE_OK,_("No valid data returned (%s)\n"), show);
506 else if (nulloid == 1)
507 die (STATE_WARNING,_("No valid data returned (%s)\n"), show);
508 else if (nulloid == 2)
509 die (STATE_CRITICAL,_("No valid data returned (%s)\n"), show);
510 }
474 while (i >= response_size) { 511 while (i >= response_size) {
475 response_size += OID_COUNT_STEP; 512 response_size += OID_COUNT_STEP;
476 response_value = realloc(response_value, response_size * sizeof(*response_value)); 513 response_value = realloc(response_value, response_size * sizeof(*response_value));
@@ -576,20 +613,24 @@ main (int argc, char **argv)
576 len = sizeof(perfstr)-strlen(perfstr)-1; 613 len = sizeof(perfstr)-strlen(perfstr)-1;
577 strncat(perfstr, show, len>ptr-show ? ptr-show : len); 614 strncat(perfstr, show, len>ptr-show ? ptr-show : len);
578 615
616 if (strcmp(type, "") != 0) {
617 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
618 }
619
579 if (warning_thresholds) { 620 if (warning_thresholds) {
580 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); 621 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
581 strncat(perfstr, warning_thresholds, sizeof(perfstr)-strlen(perfstr)-1); 622 if(thlds[i]->warning && thlds[i]->warning->text)
623 strncat(perfstr, thlds[i]->warning->text, sizeof(perfstr)-strlen(perfstr)-1);
582 } 624 }
583 625
584 if (critical_thresholds) { 626 if (critical_thresholds) {
585 if (!warning_thresholds) 627 if (!warning_thresholds)
586 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); 628 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
587 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); 629 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
588 strncat(perfstr, critical_thresholds, sizeof(perfstr)-strlen(perfstr)-1); 630 if(thlds[i]->critical && thlds[i]->critical->text)
631 strncat(perfstr, thlds[i]->critical->text, sizeof(perfstr)-strlen(perfstr)-1);
589 } 632 }
590 633
591 if (type)
592 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
593 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); 634 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
594 } 635 }
595 } 636 }
@@ -601,7 +642,7 @@ main (int argc, char **argv)
601 state_string=malloc(string_length); 642 state_string=malloc(string_length);
602 if(state_string==NULL) 643 if(state_string==NULL)
603 die(STATE_UNKNOWN, _("Cannot malloc")); 644 die(STATE_UNKNOWN, _("Cannot malloc"));
604 645
605 current_length=0; 646 current_length=0;
606 for(i=0; i<total_oids; i++) { 647 for(i=0; i<total_oids; i++) {
607 xasprintf(&temp_string,"%.0f",response_value[i]); 648 xasprintf(&temp_string,"%.0f",response_value[i]);
@@ -623,7 +664,7 @@ main (int argc, char **argv)
623 state_string[--current_length]='\0'; 664 state_string[--current_length]='\0';
624 if (verbose > 2) 665 if (verbose > 2)
625 printf("State string=%s\n",state_string); 666 printf("State string=%s\n",state_string);
626 667
627 /* This is not strictly the same as time now, but any subtle variations will cancel out */ 668 /* This is not strictly the same as time now, but any subtle variations will cancel out */
628 np_state_write_string(current_time, state_string ); 669 np_state_write_string(current_time, state_string );
629 if(previous_state==NULL) { 670 if(previous_state==NULL) {
@@ -655,6 +696,7 @@ process_arguments (int argc, char **argv)
655 {"oid", required_argument, 0, 'o'}, 696 {"oid", required_argument, 0, 'o'},
656 {"object", required_argument, 0, 'o'}, 697 {"object", required_argument, 0, 'o'},
657 {"delimiter", required_argument, 0, 'd'}, 698 {"delimiter", required_argument, 0, 'd'},
699 {"nulloid", required_argument, 0, 'z'},
658 {"output-delimiter", required_argument, 0, 'D'}, 700 {"output-delimiter", required_argument, 0, 'D'},
659 {"string", required_argument, 0, 's'}, 701 {"string", required_argument, 0, 's'},
660 {"timeout", required_argument, 0, 't'}, 702 {"timeout", required_argument, 0, 't'},
@@ -680,6 +722,11 @@ process_arguments (int argc, char **argv)
680 {"offset", required_argument, 0, L_OFFSET}, 722 {"offset", required_argument, 0, L_OFFSET},
681 {"invert-search", no_argument, 0, L_INVERT_SEARCH}, 723 {"invert-search", no_argument, 0, L_INVERT_SEARCH},
682 {"perf-oids", no_argument, 0, 'O'}, 724 {"perf-oids", no_argument, 0, 'O'},
725 {"ipv4", no_argument, 0, '4'},
726 {"ipv6", no_argument, 0, '6'},
727 {"multiplier", required_argument, 0, 'M'},
728 {"fmtstr", required_argument, 0, 'f'},
729 {"ignore-mib-parsing-errors", no_argument, false, L_IGNORE_MIB_PARSING_ERRORS},
683 {0, 0, 0, 0} 730 {0, 0, 0, 0}
684 }; 731 };
685 732
@@ -697,7 +744,7 @@ process_arguments (int argc, char **argv)
697 } 744 }
698 745
699 while (1) { 746 while (1) {
700 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:", 747 c = getopt_long (argc, argv, "nhvVO46t: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:M:f:z:",
701 longopts, &option); 748 longopts, &option);
702 749
703 if (c == -1 || c == EOF) 750 if (c == -1 || c == EOF)
@@ -808,6 +855,12 @@ process_arguments (int argc, char **argv)
808 eval_method[j+1] |= CRIT_PRESENT; 855 eval_method[j+1] |= CRIT_PRESENT;
809 } 856 }
810 break; 857 break;
858 case 'z': /* Null OID Return Check */
859 if (!is_integer (optarg))
860 usage2 (_("Exit status must be a positive integer"), optarg);
861 else
862 nulloid = atoi(optarg);
863 break;
811 case 's': /* string or substring */ 864 case 's': /* string or substring */
812 strncpy (string_value, optarg, sizeof (string_value) - 1); 865 strncpy (string_value, optarg, sizeof (string_value) - 1);
813 string_value[sizeof (string_value) - 1] = 0; 866 string_value[sizeof (string_value) - 1] = 0;
@@ -821,6 +874,7 @@ process_arguments (int argc, char **argv)
821 break; 874 break;
822 case 'R': /* regex */ 875 case 'R': /* regex */
823 cflags = REG_ICASE; 876 cflags = REG_ICASE;
877 // fall through
824 case 'r': /* regex */ 878 case 'r': /* regex */
825 cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 879 cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
826 strncpy (regex_expect, optarg, sizeof (regex_expect) - 1); 880 strncpy (regex_expect, optarg, sizeof (regex_expect) - 1);
@@ -922,6 +976,26 @@ process_arguments (int argc, char **argv)
922 case 'O': 976 case 'O':
923 perf_labels=0; 977 perf_labels=0;
924 break; 978 break;
979 case '4':
980 break;
981 case '6':
982 xasprintf(&ip_version, "udp6:");
983 if(verbose>2)
984 printf("IPv6 detected! Will pass \"udp6:\" to snmpget.\n");
985 break;
986 case 'M':
987 if ( strspn( optarg, "0123456789.," ) == strlen( optarg ) ) {
988 multiplier=strtod(optarg,NULL);
989 }
990 break;
991 case 'f':
992 if (multiplier != 1.0) {
993 fmtstr=optarg;
994 fmtstr_set = true;
995 }
996 break;
997 case L_IGNORE_MIB_PARSING_ERRORS:
998 ignore_mib_parsing_errors = true;
925 } 999 }
926 } 1000 }
927 1001
@@ -991,7 +1065,7 @@ validate_arguments ()
991 contextargs[0] = strdup ("-n"); 1065 contextargs[0] = strdup ("-n");
992 contextargs[1] = strdup (context); 1066 contextargs[1] = strdup (context);
993 } 1067 }
994 1068
995 if (seclevel == NULL) 1069 if (seclevel == NULL)
996 xasprintf(&seclevel, "noAuthNoPriv"); 1070 xasprintf(&seclevel, "noAuthNoPriv");
997 1071
@@ -1112,6 +1186,44 @@ nextarg (char *str)
1112 1186
1113 1187
1114 1188
1189/* multiply result (values 0 < n < 1 work as divider) */
1190char *
1191multiply (char *str)
1192{
1193 char *endptr;
1194 double val;
1195 char *conv = "%f";
1196
1197 if(multiplier == 1)
1198 return(str);
1199
1200 if(verbose>2)
1201 printf(" multiply input: %s\n", str);
1202
1203 val = strtod (str, &endptr);
1204 if ((val == 0.0) && (endptr == str)) {
1205 die(STATE_UNKNOWN, _("multiplier set (%.1f), but input is not a number: %s"), multiplier, str);
1206 }
1207
1208 if(verbose>2)
1209 printf(" multiply extracted double: %f\n", val);
1210 val *= multiplier;
1211 if (fmtstr_set) {
1212 conv = fmtstr;
1213 }
1214 if (val == (int)val) {
1215 snprintf(buffer, DEFAULT_BUFFER_SIZE, "%.0f", val);
1216 } else {
1217 if(verbose>2)
1218 printf(" multiply using format: %s\n", conv);
1219 snprintf(buffer, DEFAULT_BUFFER_SIZE, conv, val);
1220 }
1221 if(verbose>2)
1222 printf(" multiply result: %s\n", buffer);
1223 return buffer;
1224}
1225
1226
1115void 1227void
1116print_help (void) 1228print_help (void)
1117{ 1229{
@@ -1127,6 +1239,7 @@ print_help (void)
1127 1239
1128 printf (UT_HELP_VRSN); 1240 printf (UT_HELP_VRSN);
1129 printf (UT_EXTRA_OPTS); 1241 printf (UT_EXTRA_OPTS);
1242 printf (UT_IPv46);
1130 1243
1131 printf (UT_HOST_PORT, 'p', DEFAULT_PORT); 1244 printf (UT_HOST_PORT, 'p', DEFAULT_PORT);
1132 1245
@@ -1150,7 +1263,7 @@ print_help (void)
1150 printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY); 1263 printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY);
1151 printf (" %s\n", "-U, --secname=USERNAME"); 1264 printf (" %s\n", "-U, --secname=USERNAME");
1152 printf (" %s\n", _("SNMPv3 username")); 1265 printf (" %s\n", _("SNMPv3 username"));
1153 printf (" %s\n", "-A, --authpassword=PASSWORD"); 1266 printf (" %s\n", "-A, --authpasswd=PASSWORD");
1154 printf (" %s\n", _("SNMPv3 authentication password")); 1267 printf (" %s\n", _("SNMPv3 authentication password"));
1155 printf (" %s\n", "-X, --privpasswd=PASSWORD"); 1268 printf (" %s\n", "-X, --privpasswd=PASSWORD");
1156 printf (" %s\n", _("SNMPv3 privacy password")); 1269 printf (" %s\n", _("SNMPv3 privacy password"));
@@ -1165,6 +1278,14 @@ print_help (void)
1165 printf (" %s \"%s\"\n", _("Delimiter to use when parsing returned data. Default is"), DEFAULT_DELIMITER); 1278 printf (" %s \"%s\"\n", _("Delimiter to use when parsing returned data. Default is"), DEFAULT_DELIMITER);
1166 printf (" %s\n", _("Any data on the right hand side of the delimiter is considered")); 1279 printf (" %s\n", _("Any data on the right hand side of the delimiter is considered"));
1167 printf (" %s\n", _("to be the data that should be used in the evaluation.")); 1280 printf (" %s\n", _("to be the data that should be used in the evaluation."));
1281 printf (" %s\n", "-z, --nulloid=#");
1282 printf (" %s\n", _("If the check returns a 0 length string or NULL value"));
1283 printf (" %s\n", _("This option allows you to choose what status you want it to exit"));
1284 printf (" %s\n", _("Excluding this option renders the default exit of 3(STATE_UNKNOWN)"));
1285 printf (" %s\n", _("0 = OK"));
1286 printf (" %s\n", _("1 = WARNING"));
1287 printf (" %s\n", _("2 = CRITICAL"));
1288 printf (" %s\n", _("3 = UNKNOWN"));
1168 1289
1169 /* Tests Against Integers */ 1290 /* Tests Against Integers */
1170 printf (" %s\n", "-w, --warning=THRESHOLD(s)"); 1291 printf (" %s\n", "-w, --warning=THRESHOLD(s)");
@@ -1176,7 +1297,7 @@ print_help (void)
1176 printf (" %s\n", "--rate-multiplier"); 1297 printf (" %s\n", "--rate-multiplier");
1177 printf (" %s\n", _("Converts rate per second. For example, set to 60 to convert to per minute")); 1298 printf (" %s\n", _("Converts rate per second. For example, set to 60 to convert to per minute"));
1178 printf (" %s\n", "--offset=OFFSET"); 1299 printf (" %s\n", "--offset=OFFSET");
1179 printf (" %s\n", _("Add/substract the specified OFFSET to numeric sensor data")); 1300 printf (" %s\n", _("Add/subtract the specified OFFSET to numeric sensor data"));
1180 1301
1181 /* Tests Against Strings */ 1302 /* Tests Against Strings */
1182 printf (" %s\n", "-s, --string=STRING"); 1303 printf (" %s\n", "-s, --string=STRING");
@@ -1195,14 +1316,22 @@ print_help (void)
1195 printf (" %s\n", _("Units label(s) for output data (e.g., 'sec.').")); 1316 printf (" %s\n", _("Units label(s) for output data (e.g., 'sec.')."));
1196 printf (" %s\n", "-D, --output-delimiter=STRING"); 1317 printf (" %s\n", "-D, --output-delimiter=STRING");
1197 printf (" %s\n", _("Separates output on multiple OID requests")); 1318 printf (" %s\n", _("Separates output on multiple OID requests"));
1319 printf (" %s\n", "-M, --multiplier=FLOAT");
1320 printf (" %s\n", _("Multiplies current value, 0 < n < 1 works as divider, defaults to 1"));
1321 printf (" %s\n", "-f, --fmtstr=STRING");
1322 printf (" %s\n", _("C-style format string for float values (see option -M)"));
1198 1323
1199 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 1324 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
1325 printf (" %s\n", _("NOTE the final timeout value is calculated using this formula: timeout_interval * retries + 5"));
1200 printf (" %s\n", "-e, --retries=INTEGER"); 1326 printf (" %s\n", "-e, --retries=INTEGER");
1201 printf (" %s\n", _("Number of retries to be used in the requests")); 1327 printf (" %s%i\n", _("Number of retries to be used in the requests, default: "), DEFAULT_RETRIES);
1202 1328
1203 printf (" %s\n", "-O, --perf-oids"); 1329 printf (" %s\n", "-O, --perf-oids");
1204 printf (" %s\n", _("Label performance data with OIDs instead of --label's")); 1330 printf (" %s\n", _("Label performance data with OIDs instead of --label's"));
1205 1331
1332 printf (" %s\n", "--ignore-mib-parsing-errors");
1333 printf (" %s\n", _("Tell snmpget to not print errors encountered when parsing MIB files"));
1334
1206 printf (UT_VERBOSE); 1335 printf (UT_VERBOSE);
1207 1336
1208 printf ("\n"); 1337 printf ("\n");
@@ -1245,5 +1374,6 @@ print_usage (void)
1245 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); 1374 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
1246 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); 1375 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
1247 printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n"); 1376 printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n");
1248 printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]\n"); 1377 printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [-4|6]\n");
1378 printf ("[-M multiplier [-f format]]\n");
1249} 1379}