summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8899bc8)
raw | patch | inline | side by side (parent: 8899bc8)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Sun, 15 Apr 2007 06:44:46 +0000 (06:44 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Sun, 15 Apr 2007 06:44:46 +0000 (06:44 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1687 f882894a-f735-0410-b71e-b25c423dba1c
BUGS | patch | blob | history | |
plugins/check_snmp.c | patch | blob | history |
index 5364df008412fe25d5decf0d12b60649943971ff..d2cefc1a5636e1b2169ec62d6f67610200a58c68 100644 (file)
--- a/BUGS
+++ b/BUGS
1381604 - Perlsec breaks any perl plugin with perl 5.8.x
1373801 - check_ping timeout on Mandrake 10.1
1370031 - check_disk_smb requires DNS agree with NetBIOS names
-1344584 - check_snmp counter64 values not handled correctly
1291987 - urlize useragent does not work
1225470 - check_swap perf data incorrect
1218438 - check_radius linking to wrong header
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index c43f1efbcbe315c2490dada0f17d6cd43c5a846b..741ad3ea46b70e880331a74bc4e9e2af94a4066b 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
* Nagios check_snmp plugin
*
* License: GPL
-* Copyright (c) 1999-2006 nagios-plugins team
+* Copyright (c) 1999-2007 nagios-plugins team
*
* Last Modified: $Date$
*
*
* This file contains the check_snmp plugin
*
-* Check status of remote machines and obtain sustem information via SNMP
+* Check status of remote machines and obtain system information via SNMP
*
*
* License Information:
const char *progname = "check_snmp";
const char *revision = "$Revision$";
-const char *copyright = "1999-2006";
+const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
int validate_arguments (void);
char *clarify_message (char *);
int check_num (int);
-int lu_getll (unsigned long *, char *);
-int lu_getul (unsigned long *, char *);
+int llu_getll (unsigned long long *, char *);
+int llu_getul (unsigned long long *, char *);
char *thisarg (char *str);
char *nextarg (char *str);
void print_usage (void);
size_t unitv_size = 8;
int verbose = FALSE;
int usesnmpgetnext = FALSE;
-unsigned long lower_warn_lim[MAX_OIDS];
-unsigned long upper_warn_lim[MAX_OIDS];
-unsigned long lower_crit_lim[MAX_OIDS];
-unsigned long upper_crit_lim[MAX_OIDS];
-unsigned long response_value[MAX_OIDS];
+unsigned long long lower_warn_lim[MAX_OIDS];
+unsigned long long upper_warn_lim[MAX_OIDS];
+unsigned long long lower_crit_lim[MAX_OIDS];
+unsigned long long upper_crit_lim[MAX_OIDS];
+unsigned long long response_value[MAX_OIDS];
int check_warning_value = FALSE;
int check_critical_value = FALSE;
int retries = 0;
-unsigned long eval_method[MAX_OIDS];
+unsigned long long eval_method[MAX_OIDS];
char *delimiter;
char *output_delim;
char *miblist = NULL;
show = strstr (response, "Counter32: ") + 11;
strcpy(type, "c");
}
+ else if (strstr (response, "Counter64: ")) {
+ show = strstr (response, "Counter64: ") + 11;
+ strcpy(type, "c");
+ }
else if (strstr (response, "INTEGER: "))
show = strstr (response, "INTEGER: ") + 9;
else if (strstr (response, "STRING: "))
die (STATE_UNKNOWN,_("No valid data returned"));
response_value[i] = strtoul (p2, NULL, 10);
iresult = check_num (i);
- asprintf (&show, "%lu", response_value[i]);
+ asprintf (&show, "%llu", response_value[i]);
}
/* Process this block for string matching */
if (strspn (optarg, "0123456789:,") < strlen (optarg))
usage2 (_("Invalid critical threshold: %s\n"), optarg);
for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) {
- if (lu_getll (&lower_crit_lim[jj], ptr) == 1)
+ if (llu_getll (&lower_crit_lim[jj], ptr) == 1)
eval_method[jj] |= CRIT_LT;
- if (lu_getul (&upper_crit_lim[jj], ptr) == 1)
+ if (llu_getul (&upper_crit_lim[jj], ptr) == 1)
eval_method[jj] |= CRIT_GT;
(ptr = index (ptr, ',')) ? ptr++ : ptr;
}
if (strspn (optarg, "0123456789:,") < strlen (optarg))
usage2 (_("Invalid warning threshold: %s\n"), optarg);
for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) {
- if (lu_getll (&lower_warn_lim[ii], ptr) == 1)
+ if (llu_getll (&lower_warn_lim[ii], ptr) == 1)
eval_method[ii] |= WARN_LT;
- if (lu_getul (&upper_warn_lim[ii], ptr) == 1)
+ if (llu_getul (&upper_warn_lim[ii], ptr) == 1)
eval_method[ii] |= WARN_GT;
(ptr = index (ptr, ',')) ? ptr++ : ptr;
}
int
-lu_getll (unsigned long *ll, char *str)
+llu_getll (unsigned long long *ll, char *str)
{
char tmp[100];
if (strchr (str, ':') == NULL)
return 0;
if (strchr (str, ',') != NULL && (strchr (str, ',') < strchr (str, ':')))
return 0;
- if (sscanf (str, "%lu%[:]", ll, tmp) == 2)
+ if (sscanf (str, "%llu%[:]", ll, tmp) == 2)
return 1;
return 0;
}
int
-lu_getul (unsigned long *ul, char *str)
+llu_getul (unsigned long long *ul, char *str)
{
char tmp[100];
- if (sscanf (str, "%lu%[^,]", ul, tmp) == 1)
+ if (sscanf (str, "%llu%[^,]", ul, tmp) == 1)
return 1;
- if (sscanf (str, ":%lu%[^,]", ul, tmp) == 1)
+ if (sscanf (str, ":%llu%[^,]", ul, tmp) == 1)
return 1;
- if (sscanf (str, "%*u:%lu%[^,]", ul, tmp) == 1)
+ if (sscanf (str, "%*u:%llu%[^,]", ul, tmp) == 1)
return 1;
return 0;
}