summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Eble <psychotrahe@users.sourceforge.net>2008-07-09 21:53:12 +0000
committerMatthias Eble <psychotrahe@users.sourceforge.net>2008-07-09 21:53:12 +0000
commitbe144b672094a11b6a670df9562e26e6a56ff03f (patch)
tree6ad84d3ac28b302694b8b7803fae67a3bb28988c
parenta25083faf9c4149d82b9725b61bbc72dc956621c (diff)
downloadmonitoring-plugins-be144b672094a11b6a670df9562e26e6a56ff03f.tar.gz
check_snmp now only prints perfdata for non numeric values (Joerg Linge #1867716)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2021 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS1
-rw-r--r--plugins/check_snmp.c18
2 files changed, 12 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 64221524..3b95babc 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ This file documents the major additions and syntax changes between releases.
7 Fix Debian bug #479013: check_dig's -l is mandatory now (sf.net #1986306) 7 Fix Debian bug #479013: check_dig's -l is mandatory now (sf.net #1986306)
8 check_dig now returns CRITICAL instead of WARNING when no answer section is found 8 check_dig now returns CRITICAL instead of WARNING when no answer section is found
9 check_procs now captures stderr in external command and adds to plugin output 9 check_procs now captures stderr in external command and adds to plugin output
10 check_snmp now only prints perfdata for non numeric values (#1867716)
10 11
111.4.12 27th May 2008 121.4.12 27th May 2008
12 Added ./check_nt -v INSTANCES to count number of instances (Alessandro Ren) 13 Added ./check_nt -v INSTANCES to count number of instances (Alessandro Ren)
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 0acade25..544c5c0b 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -228,14 +228,14 @@ main (int argc, char **argv)
228 228
229 strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1); 229 strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1);
230 while (ptr) { 230 while (ptr) {
231 char *foo; 231 char *foo, *ptr2;
232 unsigned int copylen; 232 unsigned int copylen;
233 233
234 foo = strstr (ptr, delimiter); 234 foo = strstr (ptr, delimiter);
235 copylen = foo-ptr; 235 copylen = foo-ptr;
236 if (copylen > sizeof(perfstr)-strlen(perfstr)-1) 236 if (copylen > sizeof(perfstr)-strlen(perfstr)-1)
237 copylen = sizeof(perfstr)-strlen(perfstr)-1; 237 copylen = sizeof(perfstr)-strlen(perfstr)-1;
238 strncat(perfstr, ptr, copylen); 238 ptr2 = ptr;
239 ptr = foo; 239 ptr = foo;
240 240
241 if (ptr == NULL) 241 if (ptr == NULL)
@@ -368,11 +368,15 @@ main (int argc, char **argv)
368 368
369 i++; 369 i++;
370 370
371 strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); 371 if (is_numeric(show)) {
372 strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); 372 strncat(perfstr, ptr2, copylen);
373 if (type) 373 strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
374 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); 374 strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
375 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); 375
376 if (type)
377 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
378 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
379 }
376 380
377 } /* end while (ptr) */ 381 } /* end while (ptr) */
378 382