[PATCH 4/4] Revert "check_snmp now considers strings returned by SNMP that contain just"

Thomas Guyot-Sionnest dermoth at aei.ca
Wed Dec 1 03:48:43 UTC 2010


This reverts commit 896962a1ad1b7d7c75d42c565b06cc799feb0a7c.

Conflicts:

	NEWS
	plugins/tests/check_snmp.t

Notes:
	Reverting because I rebased a patch that was doing the same thing, plus
	fixing more related regressions, and both didn't work together.
	I kept the tests intact except for one that wouldn't pass on 1.4.14
	either
---
 NEWS                       |    5 -----
 plugins/check_snmp.c       |   14 --------------
 plugins/tests/check_snmp.t |    6 +-----
 3 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/NEWS b/NEWS
index 27e69c6..e3e8f37 100644
--- a/NEWS
+++ b/NEWS
@@ -3,11 +3,6 @@ This file documents the major additions and syntax changes between releases.
  ...
 
 	FIXES
-	check_snmp now attempts to convert string responses into a double value. If the full string is a value,
-	  check_snmp will consider it a numeric value and thus apply threshold checks and return performance data.
-	  This reverts back to 1.4.14 behaviour with strings
-
-	FIXES
 	Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds.
 
 1.4.15 27th July 2010
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index cb7fb7a..d79da8c 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -160,7 +160,6 @@ main (int argc, char **argv)
 	char *outbuff;
 	char *ptr = NULL;
 	char *show = NULL;
-	char *endptr = NULL;
 	char *th_warn=NULL;
 	char *th_crit=NULL;
 	char type[8] = "";
@@ -390,19 +389,6 @@ main (int argc, char **argv)
 				}
 			}
 
-			/* Allow numeric conversion if whole string is a number. Make concession for strings with " at beginning or end */
-			/* This duplicates the conversion a bit later, but is cleaner to separate out the checking against the conversion */
-			ptr = show;
-			if (*ptr == '"')
-				ptr++;
-			if (*ptr != '\0' ) {
-				strtod( ptr, &endptr );
-				if (*endptr == '"')
-					endptr++;
-				if (*endptr == '\0')
-					is_numeric=1;
-			}
-
 		}
 		else if (strstr (response, "Timeticks: ")) {
 			show = strstr (response, "Timeticks: ");
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t
index 6966838..c960f7b 100755
--- a/plugins/tests/check_snmp.t
+++ b/plugins/tests/check_snmp.t
@@ -54,7 +54,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
 # We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data
 $ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
 
-my $tests = 41;
+my $tests = 39;
 if (-x "./check_snmp") {
 	plan tests => $tests;
 } else {
@@ -173,10 +173,6 @@ $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1
 is($res->return_code, 0, "OK as string doesn't match but inverted" );
 is($res->output, 'SNMP OK - "stringtests" | ', "OK as inverted string no match" );
 
-$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.12" );
-is($res->return_code, 0, "Numeric in string test" );
-is($res->output, 'SNMP OK - 3.5 | iso.3.6.1.4.1.8072.3.2.67.12=3.5 ', "Check seen as numeric" );
-
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.12 -w 4:5" );
 is($res->return_code, 1, "Numeric in string test" );
 is($res->output, 'SNMP WARNING - *3.5* | iso.3.6.1.4.1.8072.3.2.67.12=3.5 ', "WARNING threshold checks for string masquerading as number" );
-- 
1.7.3.2


--------------090703020403040209050707--



------------=_1293143593-9696-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 607736-close) by bugs.debian.org; 23 Dec 2010 22:32:30 +0000
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on busoni.debian.org
X-Spam-Level: 
X-Spam-Bayes: score:0.0000 Tokens: new, 47; hammy, 151; neutral, 136; spammy,
	0. spammytokens: hammytokens:0.000-+--HX-Debian:DAK,
	0.000-+--H*rp:D*ftp-master.debian.org, 0.000-+--HX-DAK:process-upload,
	0.000-+--H*MI:franck, 0.000-+--HX-Spam-Relays-External:128.148.34.3
X-Spam-Status: No, score=-11.2 required=4.0 tests=AWL,BAYES_00,
	FVGT_m_MULTI_ODD,HAS_BUG_NUMBER,IMPRONONCABLE_2,MURPHY_DRUGS_REL8,
	MURPHY_WRONG_WORD1,MURPHY_WRONG_WORD2,PGPSIGNATURE autolearn=ham
	version=3.2.5-bugs.debian.org_2005_01_02
Return-path: <envelope at ftp-master.debian.org>
Received: from franck.debian.org ([128.148.34.3])
	from C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=franck.debian.org,EMAIL=hostmaster at franck.debian.org (verified)
	by busoni.debian.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.69)
	(envelope-from <envelope at ftp-master.debian.org>)
	id 1PVti2-0002ST-FC
	for 607736-close at bugs.debian.org; Thu, 23 Dec 2010 22:32:30 +0000
Received: from dak by franck.debian.org with local (Exim 4.69)
	(envelope-from <envelope at ftp-master.debian.org>)
	id 1PVti1-0000dB-8j; Thu, 23 Dec 2010 22:32:29 +0000
From: Jan Wagner <waja at cyconet.org>
To: 607736-close at bugs.debian.org
X-DAK: dak process-upload
X-Debian: DAK
X-Debian-Package: nagios-plugins
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Subject: Bug#607736: fixed in nagios-plugins 1.4.15-3
Message-Id: <E1PVti1-0000dB-8j at franck.debian.org>
Sender: Archive Administrator <dak at franck.debian.org>
Date: Thu, 23 Dec 2010 22:32:29 +0000

Source: nagios-plugins
Source-Version: 1.4.15-3

We believe that the bug you reported is fixed in the latest version of
nagios-plugins, which is due to be installed in the Debian FTP archive:

nagios-plugins-basic_1.4.15-3_i386.deb
  to main/n/nagios-plugins/nagios-plugins-basic_1.4.15-3_i386.deb
nagios-plugins-standard_1.4.15-3_i386.deb
  to main/n/nagios-plugins/nagios-plugins-standard_1.4.15-3_i386.deb
nagios-plugins_1.4.15-3.diff.gz
  to main/n/nagios-plugins/nagios-plugins_1.4.15-3.diff.gz
nagios-plugins_1.4.15-3.dsc
  to main/n/nagios-plugins/nagios-plugins_1.4.15-3.dsc
nagios-plugins_1.4.15-3_all.deb
  to main/n/nagios-plugins/nagios-plugins_1.4.15-3_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 607736 at bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jan Wagner <waja at cyconet.org> (supplier of updated nagios-plugins package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster at debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 22 Dec 2010 00:43:02 +0100
Source: nagios-plugins
Binary: nagios-plugins nagios-plugins-basic nagios-plugins-standard
Architecture: source all i386
Version: 1.4.15-3
Distribution: unstable
Urgency: low
Maintainer: Debian Nagios Maintainer Group <pkg-nagios-devel at lists.alioth.debian.org>
Changed-By: Jan Wagner <waja at cyconet.org>
Description: 
 nagios-plugins - Plugins for the nagios network monitoring and management system
 nagios-plugins-basic - Plugins for the nagios network monitoring and management system
 nagios-plugins-standard - Plugins for the nagios network monitoring and management system
Closes: 601696 601699 603414 607736
Changes: 
 nagios-plugins (1.4.15-3) unstable; urgency=low
 .
   * Add 10_check_disk_smb_spaces.dpatch from upstream svn (Closes: #601699),
     thanks to Adam Buchbinder
   * Add 11_check_disk_smb_NT_STATUS_ACCESS_DENIED.dpatch from upstream svn
     (Closes: #601696), thanks to Adam Buchbinder
   * Fix broken symlink of README.Debian.plugins (Closes: #603414), thanks
     Bernd Zeimetz
   * Add patche provided by upstream to fix regressions with check_snmp
     introduced in 1.4.15 (Closes: #607736)
     - 12_check_snmp_1.4.15_regression.dpatch
Checksums-Sha1: 
 21f056e3ae906740094f5e4252144c83c207310d 1542 nagios-plugins_1.4.15-3.dsc
 ecef693f1553225ee956c58fd19548fa93430440 32845 nagios-plugins_1.4.15-3.diff.gz
 f8389ed3ce9a3ae460c12e91589b872a2557a137 21094 nagios-plugins_1.4.15-3_all.deb
 1003af182738258ff177d4dc24f7509dcc3679a3 687228 nagios-plugins-basic_1.4.15-3_i386.deb
 5b3e0f3b032e4e5a7b0e4139ac9d13946cf0bc47 351414 nagios-plugins-standard_1.4.15-3_i386.deb
Checksums-Sha256: 
 7b980535f5e067b1bd892a57593a43f6552495a24acb2e0e551a49a989a86b58 1542 nagios-plugins_1.4.15-3.dsc
 3552a9a80410532cea24b818e6415d171c3bf6525347345ad86eddc5bcadb4c1 32845 nagios-plugins_1.4.15-3.diff.gz
 de08e76e3309bfdf5c793acccc806a810c4efdf77a71a58206aa2757ef526408 21094 nagios-plugins_1.4.15-3_all.deb
 766fb3f2d962412dcd688019b8b3113a1186b4c87047d386bc4dc3d26f2dc650 687228 nagios-plugins-basic_1.4.15-3_i386.deb
 5d2830e43082294a58888b76236bbb4105c0c8b27222bdd501b7b7a05757ddb7 351414 nagios-plugins-standard_1.4.15-3_i386.deb
Files: 
 95157baf22c1a856d6c2c3f3e4c83671 1542 net extra nagios-plugins_1.4.15-3.dsc
 13b6e787bc8e83e2e09c18413a391090 32845 net extra nagios-plugins_1.4.15-3.diff.gz
 3b5e353833a55fdfb7ce5a0b6ed66a30 21094 net extra nagios-plugins_1.4.15-3_all.deb
 959624dd43e953b219f9ffc9c8d78444 687228 net extra nagios-plugins-basic_1.4.15-3_i386.deb
 37b1e35a7fc6b53d42c1524cc0af604b 351414 net extra nagios-plugins-standard_1.4.15-3_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFNExVJ9u6Dud+QFyQRAq1yAJ0b0TI9022NDbQCeQMyVlZmMJIIEACg5yow
6wdB8PPDH5qgFNPbhrlBavw=
=2uxz
-----END PGP SIGNATURE-----



------------=_1293143593-9696-0--



More information about the Pkg-nagios-devel mailing list