summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BUGS1
-rw-r--r--plugins/check_snmp.c48
2 files changed, 26 insertions, 23 deletions
diff --git a/BUGS b/BUGS
index 5364df0..d2cefc1 100644
--- a/BUGS
+++ b/BUGS
@@ -30,7 +30,6 @@ For the 1.4.8 release:
301381604 - Perlsec breaks any perl plugin with perl 5.8.x 301381604 - Perlsec breaks any perl plugin with perl 5.8.x
311373801 - check_ping timeout on Mandrake 10.1 311373801 - check_ping timeout on Mandrake 10.1
321370031 - check_disk_smb requires DNS agree with NetBIOS names 321370031 - check_disk_smb requires DNS agree with NetBIOS names
331344584 - check_snmp counter64 values not handled correctly
341291987 - urlize useragent does not work 331291987 - urlize useragent does not work
351225470 - check_swap perf data incorrect 341225470 - check_swap perf data incorrect
361218438 - check_radius linking to wrong header 351218438 - check_radius linking to wrong header
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index c43f1ef..741ad3e 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -3,7 +3,7 @@
3* Nagios check_snmp plugin 3* Nagios check_snmp plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999-2006 nagios-plugins team 6* Copyright (c) 1999-2007 nagios-plugins team
7* 7*
8* Last Modified: $Date$ 8* Last Modified: $Date$
9* 9*
@@ -11,7 +11,7 @@
11* 11*
12* This file contains the check_snmp plugin 12* This file contains the check_snmp plugin
13* 13*
14* Check status of remote machines and obtain sustem information via SNMP 14* Check status of remote machines and obtain system information via SNMP
15* 15*
16* 16*
17* License Information: 17* License Information:
@@ -36,7 +36,7 @@
36 36
37const char *progname = "check_snmp"; 37const char *progname = "check_snmp";
38const char *revision = "$Revision$"; 38const char *revision = "$Revision$";
39const char *copyright = "1999-2006"; 39const char *copyright = "1999-2007";
40const char *email = "nagiosplug-devel@lists.sourceforge.net"; 40const char *email = "nagiosplug-devel@lists.sourceforge.net";
41 41
42#include "common.h" 42#include "common.h"
@@ -84,8 +84,8 @@ int process_arguments (int, char **);
84int validate_arguments (void); 84int validate_arguments (void);
85char *clarify_message (char *); 85char *clarify_message (char *);
86int check_num (int); 86int check_num (int);
87int lu_getll (unsigned long *, char *); 87int llu_getll (unsigned long long *, char *);
88int lu_getul (unsigned long *, char *); 88int llu_getul (unsigned long long *, char *);
89char *thisarg (char *str); 89char *thisarg (char *str);
90char *nextarg (char *str); 90char *nextarg (char *str);
91void print_usage (void); 91void print_usage (void);
@@ -124,15 +124,15 @@ size_t nunits = 0;
124size_t unitv_size = 8; 124size_t unitv_size = 8;
125int verbose = FALSE; 125int verbose = FALSE;
126int usesnmpgetnext = FALSE; 126int usesnmpgetnext = FALSE;
127unsigned long lower_warn_lim[MAX_OIDS]; 127unsigned long long lower_warn_lim[MAX_OIDS];
128unsigned long upper_warn_lim[MAX_OIDS]; 128unsigned long long upper_warn_lim[MAX_OIDS];
129unsigned long lower_crit_lim[MAX_OIDS]; 129unsigned long long lower_crit_lim[MAX_OIDS];
130unsigned long upper_crit_lim[MAX_OIDS]; 130unsigned long long upper_crit_lim[MAX_OIDS];
131unsigned long response_value[MAX_OIDS]; 131unsigned long long response_value[MAX_OIDS];
132int check_warning_value = FALSE; 132int check_warning_value = FALSE;
133int check_critical_value = FALSE; 133int check_critical_value = FALSE;
134int retries = 0; 134int retries = 0;
135unsigned long eval_method[MAX_OIDS]; 135unsigned long long eval_method[MAX_OIDS];
136char *delimiter; 136char *delimiter;
137char *output_delim; 137char *output_delim;
138char *miblist = NULL; 138char *miblist = NULL;
@@ -268,6 +268,10 @@ main (int argc, char **argv)
268 show = strstr (response, "Counter32: ") + 11; 268 show = strstr (response, "Counter32: ") + 11;
269 strcpy(type, "c"); 269 strcpy(type, "c");
270 } 270 }
271 else if (strstr (response, "Counter64: ")) {
272 show = strstr (response, "Counter64: ") + 11;
273 strcpy(type, "c");
274 }
271 else if (strstr (response, "INTEGER: ")) 275 else if (strstr (response, "INTEGER: "))
272 show = strstr (response, "INTEGER: ") + 9; 276 show = strstr (response, "INTEGER: ") + 9;
273 else if (strstr (response, "STRING: ")) 277 else if (strstr (response, "STRING: "))
@@ -296,7 +300,7 @@ main (int argc, char **argv)
296 die (STATE_UNKNOWN,_("No valid data returned")); 300 die (STATE_UNKNOWN,_("No valid data returned"));
297 response_value[i] = strtoul (p2, NULL, 10); 301 response_value[i] = strtoul (p2, NULL, 10);
298 iresult = check_num (i); 302 iresult = check_num (i);
299 asprintf (&show, "%lu", response_value[i]); 303 asprintf (&show, "%llu", response_value[i]);
300 } 304 }
301 305
302 /* Process this block for string matching */ 306 /* Process this block for string matching */
@@ -501,9 +505,9 @@ process_arguments (int argc, char **argv)
501 if (strspn (optarg, "0123456789:,") < strlen (optarg)) 505 if (strspn (optarg, "0123456789:,") < strlen (optarg))
502 usage2 (_("Invalid critical threshold: %s\n"), optarg); 506 usage2 (_("Invalid critical threshold: %s\n"), optarg);
503 for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) { 507 for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) {
504 if (lu_getll (&lower_crit_lim[jj], ptr) == 1) 508 if (llu_getll (&lower_crit_lim[jj], ptr) == 1)
505 eval_method[jj] |= CRIT_LT; 509 eval_method[jj] |= CRIT_LT;
506 if (lu_getul (&upper_crit_lim[jj], ptr) == 1) 510 if (llu_getul (&upper_crit_lim[jj], ptr) == 1)
507 eval_method[jj] |= CRIT_GT; 511 eval_method[jj] |= CRIT_GT;
508 (ptr = index (ptr, ',')) ? ptr++ : ptr; 512 (ptr = index (ptr, ',')) ? ptr++ : ptr;
509 } 513 }
@@ -512,9 +516,9 @@ process_arguments (int argc, char **argv)
512 if (strspn (optarg, "0123456789:,") < strlen (optarg)) 516 if (strspn (optarg, "0123456789:,") < strlen (optarg))
513 usage2 (_("Invalid warning threshold: %s\n"), optarg); 517 usage2 (_("Invalid warning threshold: %s\n"), optarg);
514 for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) { 518 for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) {
515 if (lu_getll (&lower_warn_lim[ii], ptr) == 1) 519 if (llu_getll (&lower_warn_lim[ii], ptr) == 1)
516 eval_method[ii] |= WARN_LT; 520 eval_method[ii] |= WARN_LT;
517 if (lu_getul (&upper_warn_lim[ii], ptr) == 1) 521 if (llu_getul (&upper_warn_lim[ii], ptr) == 1)
518 eval_method[ii] |= WARN_GT; 522 eval_method[ii] |= WARN_GT;
519 (ptr = index (ptr, ',')) ? ptr++ : ptr; 523 (ptr = index (ptr, ',')) ? ptr++ : ptr;
520 } 524 }
@@ -819,14 +823,14 @@ check_num (int i)
819 823
820 824
821int 825int
822lu_getll (unsigned long *ll, char *str) 826llu_getll (unsigned long long *ll, char *str)
823{ 827{
824 char tmp[100]; 828 char tmp[100];
825 if (strchr (str, ':') == NULL) 829 if (strchr (str, ':') == NULL)
826 return 0; 830 return 0;
827 if (strchr (str, ',') != NULL && (strchr (str, ',') < strchr (str, ':'))) 831 if (strchr (str, ',') != NULL && (strchr (str, ',') < strchr (str, ':')))
828 return 0; 832 return 0;
829 if (sscanf (str, "%lu%[:]", ll, tmp) == 2) 833 if (sscanf (str, "%llu%[:]", ll, tmp) == 2)
830 return 1; 834 return 1;
831 return 0; 835 return 0;
832} 836}
@@ -834,14 +838,14 @@ lu_getll (unsigned long *ll, char *str)
834 838
835 839
836int 840int
837lu_getul (unsigned long *ul, char *str) 841llu_getul (unsigned long long *ul, char *str)
838{ 842{
839 char tmp[100]; 843 char tmp[100];
840 if (sscanf (str, "%lu%[^,]", ul, tmp) == 1) 844 if (sscanf (str, "%llu%[^,]", ul, tmp) == 1)
841 return 1; 845 return 1;
842 if (sscanf (str, ":%lu%[^,]", ul, tmp) == 1) 846 if (sscanf (str, ":%llu%[^,]", ul, tmp) == 1)
843 return 1; 847 return 1;
844 if (sscanf (str, "%*u:%lu%[^,]", ul, tmp) == 1) 848 if (sscanf (str, "%*u:%llu%[^,]", ul, tmp) == 1)
845 return 1; 849 return 1;
846 return 0; 850 return 0;
847} 851}