SF.net SVN: nagiosplug: [2021] nagiosplug/trunk

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 2021
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2021&view=rev
Author:   psychotrahe
Date:     2008-07-09 14:53:12 -0700 (Wed, 09 Jul 2008)

Log Message:
-----------
check_snmp now only prints perfdata for non numeric values (Joerg Linge #1867716)

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/plugins/check_snmp.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2008-07-08 10:09:11 UTC (rev 2020)
+++ nagiosplug/trunk/NEWS	2008-07-09 21:53:12 UTC (rev 2021)
@@ -7,6 +7,7 @@
 	Fix Debian bug #479013: check_dig's -l is mandatory now (sf.net #1986306)
 	check_dig now returns CRITICAL instead of WARNING when no answer section is found
 	check_procs now captures stderr in external command and adds to plugin output
+	check_snmp now only prints perfdata for non numeric values (#1867716)
 
 1.4.12 27th May 2008
 	Added ./check_nt -v INSTANCES to count number of instances (Alessandro Ren)

Modified: nagiosplug/trunk/plugins/check_snmp.c
===================================================================
--- nagiosplug/trunk/plugins/check_snmp.c	2008-07-08 10:09:11 UTC (rev 2020)
+++ nagiosplug/trunk/plugins/check_snmp.c	2008-07-09 21:53:12 UTC (rev 2021)
@@ -228,14 +228,14 @@
 
 	strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1);
 	while (ptr) {
-		char *foo;
+		char *foo, *ptr2;
 		unsigned int copylen;
 
 		foo = strstr (ptr, delimiter);
 		copylen = foo-ptr;
 		if (copylen > sizeof(perfstr)-strlen(perfstr)-1)
 			copylen = sizeof(perfstr)-strlen(perfstr)-1;
-		strncat(perfstr, ptr, copylen);
+		ptr2 = ptr;
 		ptr = foo; 
 
 		if (ptr == NULL)
@@ -368,12 +368,16 @@
 
 		i++;
 
-		strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
-		strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
-		if (type)
-			strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
-		strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
+		if (is_numeric(show)) {
+			strncat(perfstr, ptr2, copylen);
+			strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
+			strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
 
+			if (type)
+				strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
+			strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
+		}
+
 	}	/* end while (ptr) */
 
 	if (found == 0)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.