[svn-buildpackage] Tagging nagios-plugins 1.4.16~pre1-1

This commit is contained in:
Jan Wagner 2012-06-14 08:56:26 +00:00
17 changed files with 272 additions and 492 deletions

33
debian/changelog vendored
View file

@ -1,3 +1,36 @@
nagios-plugins (1.4.16~pre1-1) unstable; urgency=medium
* New upstream snapshot (Closes: #662638, #514588)
* Droped the following upstream integrated patches
- 10_check_disk_smb_spaces.dpatch
- 11_check_disk_smb_NT_STATUS_ACCESS_DENIED.dpatch
- 12_check_snmp_1.4.15_regression.dpatch
- 13_check_smtp_greeting.dpatch
- 14_check_icmp_multiple_ips.dpatch
- 15_check_sensors_fault.dpatch
- 16_check_raduis_fix_format-security.dpatch
- 17_check_tcp_fix_duplicate_cert_message.dpatch
- 17_check_smtp_fix_duplicate_cert_message.dpatch
- 18_check_snmp_labels.dpatch
- 19_check_http_help.dpatch
* Added the following upstream patches
- 10_check_dhcp_Fix-handling-of-pad-options.dpatch
- 11_check_dhcp_Don-t-misinterpret-the-siaddr-field.dpatch
* Add 00_fix_release_version.dpatch to fix release version
* Bump Standards-Version to 3.9.3, no changes needed
-- Jan Wagner <waja@cyconet.org> Thu, 14 Jun 2012 10:39:44 +0200
nagios-plugins (1.4.15-7) unstable; urgency=low
* Recommand nagios-plugins-contrib via nagios-plugins, drop
nagios-plugins-common which gets installed by nagios-plugins-basic
anyways
* Add Replaces: nagios-plugins-basic to nagios-plugins-common
(Closes: #673891), thanks to Christoph Anton Mitterer
-- Jan Wagner <waja@cyconet.org> Tue, 22 May 2012 20:00:03 +0200
nagios-plugins (1.4.15-6) unstable; urgency=low
* Add nagios-plugins-common package which ships files possibly needed also by

8
debian/control vendored
View file

@ -7,12 +7,12 @@ Build-Depends: debhelper (>= 5), dpatch (>= 2.0.9), perl, autotools-dev, libldap
Homepage: http://nagiosplug.sourceforge.net
Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-nagios/nagios-plugins/
Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-plugins/trunk/
Standards-Version: 3.9.2
Standards-Version: 3.9.3
Package: nagios-plugins
Architecture: all
Depends: ${misc:Depends}, nagios-plugins-basic, nagios-plugins-standard
Recommends: nagios-plugins-common
Recommends: nagios-plugins-contrib
Suggests: nagios3 | icinga
Description: Plugins for nagios compatible monitoring systems (metapackage)
Plugins for nagios compatible monitoring systems like Nagios and Icinga.
@ -25,7 +25,7 @@ Description: Plugins for nagios compatible monitoring systems (metapackage)
Package: nagios-plugins-common
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ucf
Breaks: nagios-plugins-basic (<= 1.4.15-5)
Replaces: nagios-plugins-basic (<= 1.4.15-5)
Suggests: nagios3 | icinga
Description: Common files for plugins for nagios compatible monitoring
Common files for plugins for nagios compatible monitoring systems like Nagios
@ -36,7 +36,7 @@ Description: Common files for plugins for nagios compatible monitoring
Package: nagios-plugins-basic
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, procps, iputils-ping [linux-any], inetutils-ping [kfreebsd-any hurd-any], ucf
Pre-Depends: nagios-plugins-common
Pre-Depends: nagios-plugins-common (>= 1.4.15-6)
Conflicts: nagios-plugins (<= 1.4.2-3)
Replaces: nagios-plugins, nagios-plugins-standard
Suggests: nagios3 | icinga

120
debian/patches/00_fix_release_version.dpatch vendored Executable file
View file

@ -0,0 +1,120 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 00_fix_release_version.dpatch by Jan Wagner <waja@cyconet.org>
##
## DP: Fix release version
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-plugins-1.4.16~pre1~/NP-VERSION-GEN nagios-plugins-1.4.16~pre1/NP-VERSION-GEN
--- nagios-plugins-1.4.16~pre1~/NP-VERSION-GEN 2012-04-10 12:00:04.000000000 +0200
+++ nagios-plugins-1.4.16~pre1/NP-VERSION-GEN 2012-06-13 13:01:42.000000000 +0200
@@ -6,7 +6,7 @@
SRC_ROOT=`dirname $0`
NPVF=NP-VERSION-FILE
-DEF_VER=1.4.15.git
+DEF_VER=1.4.16~pre1
LF='
'
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-plugins-1.4.16~pre1~/configure nagios-plugins-1.4.16~pre1/configure
--- nagios-plugins-1.4.16~pre1~/configure 2012-06-12 00:00:37.000000000 +0200
+++ nagios-plugins-1.4.16~pre1/configure 2012-06-13 13:03:32.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for nagios-plugins 1.4.15.
+# Generated by GNU Autoconf 2.61 for nagios-plugins 1.4.16~pre1.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -721,8 +721,8 @@
# Identity of this package.
PACKAGE_NAME='nagios-plugins'
PACKAGE_TARNAME='nagios-plugins'
-PACKAGE_VERSION='1.4.15'
-PACKAGE_STRING='nagios-plugins 1.4.15'
+PACKAGE_VERSION='1.4.16~pre1'
+PACKAGE_STRING='nagios-plugins 1.4.16~pre1'
PACKAGE_BUGREPORT=''
ac_unique_file="NPTest.pm"
@@ -2110,7 +2110,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures nagios-plugins 1.4.15 to adapt to many kinds of systems.
+\`configure' configures nagios-plugins 1.4.16~pre1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -2180,7 +2180,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of nagios-plugins 1.4.15:";;
+ short | recursive ) echo "Configuration of nagios-plugins 1.4.16~pre1:";;
esac
cat <<\_ACEOF
@@ -2328,7 +2328,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-nagios-plugins configure 1.4.15
+nagios-plugins configure 1.4.16~pre1
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -2342,7 +2342,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by nagios-plugins $as_me 1.4.15, which was
+It was created by nagios-plugins $as_me 1.4.16~pre1, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -3090,7 +3090,7 @@
# Define the identity of the package.
PACKAGE='nagios-plugins'
- VERSION='1.4.15'
+ VERSION='1.4.16~pre1'
cat >>confdefs.h <<_ACEOF
@@ -56186,7 +56186,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by nagios-plugins $as_me 1.4.15, which was
+This file was extended by nagios-plugins $as_me 1.4.16~pre1, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -56239,7 +56239,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-nagios-plugins config.status 1.4.15
+nagios-plugins config.status 1.4.16~pre1
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-plugins-1.4.16~pre1~/configure.in nagios-plugins-1.4.16~pre1/configure.in
--- nagios-plugins-1.4.16~pre1~/configure.in 2012-06-12 00:00:01.000000000 +0200
+++ nagios-plugins-1.4.16~pre1/configure.in 2012-06-13 13:02:11.000000000 +0200
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT(nagios-plugins,1.4.15)
+AC_INIT(nagios-plugins,1.4.16~pre1)
AC_CONFIG_SRCDIR(NPTest.pm)
AC_CONFIG_FILES([gl/Makefile
nagios-plugins.spec])
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-plugins-1.4.16~pre1~/release nagios-plugins-1.4.16~pre1/release
--- nagios-plugins-1.4.16~pre1~/release 2012-06-12 00:01:32.000000000 +0200
+++ nagios-plugins-1.4.16~pre1/release 2012-06-13 13:01:13.000000000 +0200
@@ -1 +1 @@
-1.4.15-59-ga80e
+1.4.16~pre1

14
debian/patches/00list vendored
View file

@ -1,14 +1,6 @@
02_check_icmp_links.dpatch
00_fix_release_version.dpatch
# commited upstream
10_check_disk_smb_spaces.dpatch
11_check_disk_smb_NT_STATUS_ACCESS_DENIED.dpatch
12_check_snmp_1.4.15_regression.dpatch
13_check_smtp_greeting.dpatch
14_check_icmp_multiple_ips.dpatch
15_check_sensors_fault.dpatch
16_check_raduis_fix_format-security.dpatch
17_check_tcp_fix_duplicate_cert_message.dpatch
17_check_smtp_fix_duplicate_cert_message.dpatch
03_check_disk_smb_perfdata.dpatch
18_check_snmp_labels.dpatch
19_check_http_help.dpatch
10_check_dhcp_Fix-handling-of-pad-options.dpatch
11_check_dhcp_Don-t-misinterpret-the-siaddr-field.dpatch

View file

@ -0,0 +1,55 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_check_dhcp_Fix-handling-of-pad-options.dpatch
## From f091d59e0f9abec9304d9d230fafc2dec001baba Mon Sep 17 00:00:00 2001
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Wed, 13 Jun 2012 12:36:42 +0200
## Subject: [PATCH] check_dhcp: Fix handling of "pad" options
## X-Git-Url: https://github.com/nagios-plugins/nagios-plugins/commit/f091d59e0f9abec9304d9d230fafc2dec001baba.patch
##
## DP: Don't let "pad" options[*] terminate the parsing of DHCP options. This bug was triggered by using check_dhcp against Windows 2003 DHCP servers (see #3503921). [*] Cf. RFC 2132, 3.1.
---
NEWS | 1 +
plugins-root/check_dhcp.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 7452a6b..b138084 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ This file documents the major additions and syntax changes between releases.
Fix segfault in check_host when hostname returns multiple IP addresses (Sebastian Harl)
Fix check_smtp and check_tcp where duplicate messages were displayed for certificate errors
Fix check_ping's parsing of the output of Debian's ping6(1) implementation (#1894850 - Matej Vela)
+ Fix a check_dhcp bug which was triggered by using it to check Windows 2003 DHCP servers (#3503921)
Disable RFC4507 support, to work around SSL negotiation issues with (at least) some Tomcat versions
1.4.15 27th July 2010
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index 2a1875c..ac89274 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -839,8 +839,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
/* process all DHCP options present in the packet */
for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){
- /* end of options (0 is really just a pad, but bail out anyway) */
- if((int)offer_packet->options[x]==-1 || (int)offer_packet->options[x]==0)
+ if((int)offer_packet->options[x]==-1)
break;
/* get option type */
@@ -872,7 +871,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
}
/* skip option data we're ignoring */
- if(option_type!=DHCP_OPTION_REBINDING_TIME)
+ if(option_type==0) /* "pad" option, see RFC 2132 (3.1) */
+ x+=1;
+ else
x+=option_length;
}
--
1.7.10

View file

@ -1,29 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_check_disk_smb_spaces.dpatch by
## Matthias Eble <psychotrahe@users.sourceforge.net>
##
## From 0892c4ac28c4c2e3b6275187f845813b4cd6d320 Mon Sep 17 00:00:00 2001
## From: Matthias Eble <psychotrahe@users.sourceforge.net>
## Date: Sun, 28 Nov 2010 21:35:59 +0100
## Subject: [PATCH] Make check_disk_smb accept spaces in share names
## (#990948, #1370031, Debian #601699)
##
## DP: Enables Support sharenames with spaces (http://bugs.debian.org/601699)
## DP: Upstream bug is: http://sourceforge.net/tracker/?func=detail&aid=990948&group_id=29880&atid=397597
@DPATCH@
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 7c81fc2..4698700 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -67,7 +67,7 @@ my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
($host) || usage("Invalid host: $opt_H\n");
($opt_s) || ($opt_s = shift @ARGV) || usage("Share volume not specified\n");
-my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/);
+my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
($share) || usage("Invalid share: $opt_s\n");
defined($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest");

View file

@ -0,0 +1,57 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 11_check_dhcp_Don-t-misinterpret-the-siaddr-field.dpatch
## From 4d5276273287ef59881b541ba96279e91974a4b2 Mon Sep 17 00:00:00 2001
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Thu, 14 Jun 2012 00:39:55 +0200
## Subject: [PATCH] check_dhcp: Don't misinterpret the "siaddr" field
## X-Git-Url: https://github.com/nagios-plugins/nagios-plugins/commit/4d5276273287ef59881b541ba96279e91974a4b2.patch
##
## DP: RFC 2131 (2.) says: "DHCP clarifies the interpretation of the 'siaddr' field as the address of the server to use in the next step of the client's bootstrap process." So, we shouldn't interpret this field as the DHCP server's own address. (#3503921 - Jason Ellison)
@DPATCH@
---
plugins-root/check_dhcp.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index ac89274..b02ee49 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -141,7 +141,7 @@
u_int16_t flags; /* flags */
struct in_addr ciaddr; /* IP address of this machine (if we already have one) */
struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */
- struct in_addr siaddr; /* IP address of DHCP server */
+ struct in_addr siaddr; /* IP address of next server */
struct in_addr giaddr; /* IP address of DHCP relay */
unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */
char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */
@@ -587,11 +587,6 @@ int get_dhcp_offer(int sock){
/* Save a copy of "source" into "via" even if it's via itself */
memcpy(&via,&source,sizeof(source)) ;
- /* If siaddr is non-zero, set "source" to siaddr */
- if(offer_packet.siaddr.s_addr != 0L){
- source.sin_addr.s_addr = offer_packet.siaddr.s_addr ;
- }
-
if(verbose){
printf(_("DHCPOFFER from IP address %s"),inet_ntoa(source.sin_addr));
printf(_(" via %s\n"),inet_ntoa(via.sin_addr));
@@ -904,9 +899,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
* the next bootstrap service (e.g., delivery of an operating system
* executable image). A DHCP server always returns its own address in
* the 'server identifier' option." 'serv_ident' is the 'server
- * identifier' option, 'source' is the 'siaddr' field or (if 'siaddr'
- * wasn't available) the IP address we received the DHCPOFFER from. If
- * 'serv_ident' isn't available for some reason, we use 'source'.
+ * identifier' option, 'source' is the IP address we received the
+ * DHCPOFFER from. If 'serv_ident' isn't available for some reason, we
+ * use 'source'.
*/
new_offer->server_address=serv_ident.s_addr?serv_ident:source;
new_offer->offered_address=offer_packet->yiaddr;
--
1.7.10

View file

@ -1,28 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 11_check_disk_smb_NT_STATUS_ACCESS_DENIED.dpatch by
## Matthias Eble <psychotrahe@users.sourceforge.net>
##
## From 3c67c9cb60a4681a29e509fccbb333e0f6234f54 Mon Sep 17 00:00:00 2001
## From: Matthias Eble <psychotrahe@users.sourceforge.net>
## Date: Sun, 28 Nov 2010 21:43:48 +0100
## Subject: [PATCH] check_disk_smb now handles NT_STATUS_ACCESS_DENIED properly
## (Debian #601696)
##
## DP: Handles NT_STATUS_ACCESS_DENIED properly (http://bugs.debian.org/601696)
@DPATCH@
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 4698700..6783543 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -239,7 +239,7 @@ if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) {
$answer = "Result from smbclient not suitable\n";
$state = "UNKNOWN";
foreach (@lines) {
- if (/(Access denied|NT_STATUS_LOGON_FAILURE)/) {
+ if (/(Access denied|NT_STATUS_LOGON_FAILURE|NT_STATUS_ACCESS_DENIED)/) {
$answer = "Access Denied\n";
$state = "CRITICAL";
last;

View file

@ -1,180 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 12_check_snmp_1.4.15_regression.dpatch by
## Thomas Guyot-Sionnest <dermoth@aei.ca>
##
## Original patch to make Timeticks works as in check_snmp v1.4.14, it turns
## out is_numeric isn't so useful and treating all types as numeric works
## best for backwards-compatibility. This is how it used to work in 1.4.14.
##
## As a special case, I also make calculate_rate look up for numeric values
## as it would otherwise return the last value instead.
##
## DP: Remove that is_numeric madness
@DPATCH@
diff --git a/NEWS b/NEWS
index ff92401..e3e8f37 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
This file documents the major additions and syntax changes between releases.
+ ...
+
+ 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
ENHANCEMENTS
New check_ntp_peer -m and -n options to check the number of usable time sources ("truechimers")
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index f32a26e..d79da8c 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -169,7 +169,6 @@ main (int argc, char **argv)
char *state_string=NULL;
size_t response_length, current_length, string_length;
char *temp_string=NULL;
- int is_numeric=0;
time_t current_time;
double temp_double;
time_t duration;
@@ -335,29 +334,24 @@ main (int argc, char **argv)
/* We strip out the datatype indicator for PHBs */
if (strstr (response, "Gauge: ")) {
show = strstr (response, "Gauge: ") + 7;
- is_numeric++;
}
else if (strstr (response, "Gauge32: ")) {
show = strstr (response, "Gauge32: ") + 9;
- is_numeric++;
}
else if (strstr (response, "Counter32: ")) {
show = strstr (response, "Counter32: ") + 11;
- is_numeric++;
is_counter=1;
if(!calculate_rate)
strcpy(type, "c");
}
else if (strstr (response, "Counter64: ")) {
show = strstr (response, "Counter64: ") + 11;
- is_numeric++;
is_counter=1;
if(!calculate_rate)
strcpy(type, "c");
}
else if (strstr (response, "INTEGER: ")) {
show = strstr (response, "INTEGER: ") + 9;
- is_numeric++;
}
else if (strstr (response, "STRING: ")) {
show = strstr (response, "STRING: ") + 8;
@@ -396,15 +390,17 @@ main (int argc, char **argv)
}
}
- else if (strstr (response, "Timeticks: "))
+ else if (strstr (response, "Timeticks: ")) {
show = strstr (response, "Timeticks: ");
+ }
else
show = response;
iresult = STATE_DEPENDENT;
/* Process this block for numeric comparisons */
- if (is_numeric) {
+ /* Make some special values,like Timeticks numeric only if a threshold is defined */
+ if (thlds[i]->warning || thlds[i]->critical || calculate_rate) {
ptr = strpbrk (show, "0123456789");
if (ptr == NULL)
die (STATE_UNKNOWN,_("No valid data returned"));
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index 004ba1a..25a2999 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -8,7 +8,7 @@ use strict;
use Test::More;
use NPTest;
-my $tests = 8+38+2+2;
+my $tests = 8+42+2+2;
plan tests => $tests;
my $res;
@@ -124,6 +124,13 @@ SKIP: {
cmp_ok( $res->return_code, '==', 0, "Skipping all thresholds");
like($res->output, '/^SNMP OK - \d+ \w+ \d+\s.*$/', "Skipping all thresholds, result printed rather than parsed");
+ $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 1000000000: -u '1/100 sec'");
+ cmp_ok( $res->return_code, '==', 2, "Timetick used as a threshold");
+ like($res->output, '/^SNMP CRITICAL - \*\d+\* 1\/100 sec.*$/', "Timetick used as a threshold, parsed as numeric");
+
+ $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0");
+ cmp_ok( $res->return_code, '==', 0, "Timetick used as a string");
+ like($res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "Timetick used as a string, result printed rather than parsed");
}
# These checks need a complete command line. An invalid community is used so
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t
index e7ad192..c960f7b 100755
--- a/plugins/tests/check_snmp.t
+++ b/plugins/tests/check_snmp.t
@@ -51,7 +51,10 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
}
}
-my $tests = 33;
+# We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data
+$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
+
+my $tests = 39;
if (-x "./check_snmp") {
plan tests => $tests;
} else {
@@ -106,7 +109,7 @@ like($res->output, '/'.quotemeta('SNMP OK - And now have fun with with this: \"C
"And now have fun with with this: \"C:\\\\\"
because we\'re not done yet!"').'/m', "Attempt to confuse parser No.3");
-system("rm /usr/local/nagios/var/check_snmp/*");
+system("rm -f ".$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'}."/check_snmp/*");
$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.10 --rate -w 600" );
is($res->return_code, 0, "Returns OK");
is($res->output, "No previous data to calculate rate - assume okay");
@@ -170,5 +173,16 @@ $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 -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" );
+
+$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.13" );
+is($res->return_code, 0, "Not really numeric test" );
+is($res->output, 'SNMP OK - "87.4startswithnumberbutshouldbestring" | ', "Check string with numeric start is still string" );
+
+$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.14" );
+is($res->return_code, 0, "Not really numeric test (trying best to fool it)" );
+is($res->output, 'SNMP OK - "555\"I said\"" | ', "Check string with a double quote following is still a string (looks like the perl routine will always escape though)" );
diff --git a/plugins/tests/check_snmp_agent.pl b/plugins/tests/check_snmp_agent.pl
index 8784ab1..2ad8516 100644
--- a/plugins/tests/check_snmp_agent.pl
+++ b/plugins/tests/check_snmp_agent.pl
@@ -33,9 +33,9 @@ ends with with this: C:\\';
my $multilin5 = 'And now have fun with with this: "C:\\"
because we\'re not done yet!';
-my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR);
-my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests");
-my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef);
+my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR );
+my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests", "3.5", "87.4startswithnumberbutshouldbestring", '555"I said"' );
+my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef, undef, undef, undef );
# Number of elements in our OID
my $oidelts;

View file

@ -1,37 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 13_check_smtp_greeting.dpatch
## Holger Weiss <holger@zedat.fu-berlin.de>
##
## From: d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c Tue, 8 Feb 2011 16:07:52 +0000 (+0100)
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Tue, 8 Feb 2011 16:07:52 +0000 (+0100)
## Subject: [PATCH] check_smtp: Abort on missing/unexpected greeting
## (Debian #611914)
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug%2Fnagiosplug;a=commitdiff_plain;h=d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c
##
## DP: Abort on missing/unexpected greeting (http://bugs.debian.org/611914)
@DPATCH@
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 3da724b..ed49163 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -183,7 +183,7 @@ main (int argc, char **argv)
/* return a WARNING status if we couldn't read any data */
if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) {
printf (_("recv() failed\n"));
- result = STATE_WARNING;
+ return STATE_WARNING;
}
else {
if (verbose)
@@ -197,7 +197,7 @@ main (int argc, char **argv)
else
printf (_("Invalid SMTP response received from host on port %d: %s\n"),
server_port, buffer);
- result = STATE_WARNING;
+ return STATE_WARNING;
}
}

View file

@ -1,27 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14_check_icmp_multiple_ips.dpatch
## Sebastian Harl <sh@teamix.net>
##
## From: 1374f80872412b64bd13f17e6edd70aa59437012 Mon Sep 17 00:00:00 2001
## From: Sebastian Harl <sh@teamix.net>
## Date: Thu, 28 Apr 2011 09:18:21 +0200
## Subject: [PATCH] check_host: Allocate a large-enough buffer for the host table.
## (Debian #623702)
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commitdiff_plain;h=1374f80872412b64bd13f17e6edd70aa59437012
##
## DP: Allocate a large-enough buffer for the host table. (http://bugs.debian.org/623702)
@DPATCH@
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -621,7 +621,7 @@ main(int argc, char **argv)
}
host = list;
- table = malloc(sizeof(struct rta_host **) * (argc - 1));
+ table = malloc(sizeof(struct rta_host **) * targets);
i = 0;
while(host) {
host->id = i*packets;

View file

@ -1,40 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 15_check_sensors_fault.dpatch by Holger Weiss <holger@zedat.fu-berlin.de>
##
## From 276c5b98bf619eabd8b0bd5fc3ff60c0a59489a7 Mon Sep 17 00:00:00 2001
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Wed, 7 Sep 2011 13:55:53 +0200
## Subject: [PATCH] check_sensors: Detect FAULT status
##
## DP: Return an UNKNOWN status if a faulty sensor is detected. This can be
## suppressed with the new "--ignore-fault" option.
@DPATCH@
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -10,7 +10,7 @@ REVISION="@NP_VERSION@"
print_usage() {
- echo "Usage: $PROGNAME"
+ echo "Usage: $PROGNAME" [--ignore-fault]
}
print_help() {
@@ -57,9 +57,12 @@ case "$1" in
if echo ${sensordata} | egrep ALARM > /dev/null; then
echo SENSOR CRITICAL - Sensor alarm detected!
exit 2
- else
- echo sensor ok
- exit 0
+ elif echo ${sensordata} | egrep FAULT > /dev/null \
+ && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
+ echo SENSOR UNKNOWN - Sensor reported fault
+ exit 3
fi
+ echo sensor ok
+ exit 0
;;
esac

View file

@ -1,24 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16_check_raduis_fix_format-security.dpatch
## From 055b2570eddff9a312dc1445bb7de4a6d7c4887d Mon Sep 17 00:00:00 2001
## From: Thomas Guyot-Sionnest <dermoth@aei.ca>
## Date: Tue, 6 Sep 2011 23:20:21 -0400
## Subject: [PATCH] Make GCC happy
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commitdiff_plain;h=055b2570eddff9a312dc1445bb7de4a6d7c4887d
##
## DP: It won't trust us about msg containing no format string, and fail miserably
## when compiled with -Werror=format-security. (https://bugs.launchpad.net/bugs/837085)
@DPATCH@
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -211,7 +211,7 @@ main (int argc, char **argv)
if (result == OK_RC)
die (STATE_OK, _("Auth OK"));
(void)snprintf(msg, sizeof(msg), _("Unexpected result code %d"), result);
- die (STATE_UNKNOWN, msg);
+ die (STATE_UNKNOWN, "%s", msg);
}

View file

@ -1,24 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17_check_smtp_fix_duplicate_cert_message.dpatch
## From 4d06603060fc1233861b164870f0d3a2e0d8d2eb Fri, 15 Jul 2011 20:19:15 +0000 (+0100)
## From: Ton Voon <ton.voon@opsera.com>
## Date: Tue, 6 Sep 2011 23:20:21 -0400
## Subject: [PATCH] Fix check_smtp and check_tcp where duplicate messages were displayed for certificate...
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commitdiff_plain;h=4d06603060fc1233861b164870f0d3a2e0d8d2eb
##
## DP: Fix check_smtp where duplicate messages were displayed for certificate errors
@DPATCH@
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -276,9 +276,6 @@ main (int argc, char **argv)
# ifdef USE_OPENSSL
if ( check_cert ) {
result = np_net_ssl_check_cert(days_till_exp);
- if(result != STATE_OK){
- printf ("%s\n", _("CRITICAL - Cannot retrieve server certificate."));
- }
my_close();
return result;
}

View file

@ -1,28 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17_check_tcp_fix_duplicate_cert_message.dpatch
## From 4d06603060fc1233861b164870f0d3a2e0d8d2eb Fri, 15 Jul 2011 20:19:15 +0000 (+0100)
## From: Ton Voon <ton.voon@opsera.com>
## Date: Tue, 6 Sep 2011 23:20:21 -0400
## Subject: [PATCH] Fix check_smtp and check_tcp where duplicate messages were displayed for certificate...
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commitdiff_plain;h=4d06603060fc1233861b164870f0d3a2e0d8d2eb
##
## DP: Fix check_tcp where duplicate messages were displayed for certificate errors
@DPATCH@
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -236,12 +236,9 @@ main (int argc, char **argv)
result = np_net_ssl_init(sd);
if (result == STATE_OK && check_cert == TRUE) {
result = np_net_ssl_check_cert(days_till_exp);
- if(result != STATE_OK) {
- printf(_("CRITICAL - Cannot retrieve server certificate.\n"));
- }
}
}
- if(result != STATE_OK){
+ if(result != STATE_OK || check_cert == TRUE){
np_net_ssl_cleanup();
if(sd) close(sd);
return result;

View file

@ -1,34 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 18_check_snmp_labels.dpatch
## From 0e3fa54782f8cbb47af058c4bf13688e8b23865b Mon Sep 17 00:00:00 2001
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Fri, 24 Feb 2012 12:29:00 +0100
## Subject: [PATCH] Accept multiple labels specified with "-l"
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=patch;h=0e3fa54782f8cbb47af058c4bf13688e8b23865b
##
## DP: check_snmp: fix multiple labels. (http://bugs.debian.org/647020)
@DPATCH@
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -749,7 +749,7 @@ process_arguments (int argc, char **argv)
if (labels == NULL)
die (STATE_UNKNOWN, _("Could not reallocate labels\n"));
}
- labels++;
+ nlabels++;
ptr = thisarg (ptr);
if (strstr (ptr, "'") == ptr)
labels[nlabels - 1] = ptr + 1;
@@ -1072,8 +1072,8 @@ print_help (void)
printf ("\n");
printf ("%s\n", _("Notes:"));
- printf (" %s\n", _("- Multiple OIDs may be indicated by a comma or space-delimited list (lists with"));
- printf (" %s %i %s\n", _("internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs."));
+ printf (" %s\n", _("- Multiple OIDs (and labels) may be indicated by a comma or space-delimited "));
+ printf (" %s %i %s\n", _("list (lists with internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs."));
printf(" -%s", UT_THRESHOLDS_NOTES);

View file

@ -1,26 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 18_check_snmp_labels.dpatch
## From d796c16327e6e315dd528f17e8bd597c5f506730 Mon Sep 17 00:00:00 2001
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Fri, 24 Feb 2012 13:24:56 +0100
## Subject: [PATCH] Clarify that check_http won't verify certificates
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=patch;h=d796c16327e6e315dd528f17e8bd597c5f506730
##
## DP: check_http: clarify that check_http won't verify certificates (http://bugs.debian.org/644627)
@DPATCH@
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1400,6 +1400,10 @@ print_help (void)
printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 "));
printf (" %s\n", _("certificate is still valid for the specified number of days."));
printf ("\n");
+ printf (" %s\n", _("Please note that this plugin does not check if the presented server"));
+ printf (" %s\n", _("certificate matches the hostname of the server, or if the certificate"));
+ printf (" %s\n", _("has a valid chain of trust to one of the locally installed CAs."));
+ printf ("\n");
printf ("%s\n", _("Examples:"));
printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com");
printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,"));