Skip to content

Commit

Permalink
Merge branch 'release-2.2.1-rc1'
Browse files Browse the repository at this point in the history
  • Loading branch information
John C. Frickson committed Apr 19, 2017
2 parents 17f8834 + f2310f1 commit 341daf6
Show file tree
Hide file tree
Showing 17 changed files with 208 additions and 102 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ NP-VERSION-FILE
/plugins-scripts/check_wave
/plugins-scripts/check_file_age

# /plugins-python
/plugins-python/Makefile.in
/plugins-python/Makefile
plugins-python/*.py
plugins-python/check_ncpa.py

# /po/
/po/Makefile
/po/Makefile.in
Expand Down
19 changes: 19 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
This file documents the major additions and syntax changes between releases.

2.2.1 2017-04-19
FIXES
check_users: not accepting zero as the threshold
check_http: reports warning where it should report ok with -e
check_snmp: does not work with -6 --ipv6 flags
check_swap: threshold calculation in bytes requires subtracting 65
check_uptime: fixed backward help text for thresholds
check_http: Don’t prematurely report success when checking HTTP TLS cert validity
check_http: fix parsing the last header
check_mailq: Fix for Postfix and better Sudo Checking
configure.ac: Fix spelling error
check_ntp_peer: requires newline when there is a socket timeout (fix in netutils.c)
check_users: segmentation fault if both thresholds are not provided
check_dns: DNS CRITICAL - expected ‘{hostname}.’ but got 'name = {hostname}.'
check_mailq: Nullmailer Regex is not working for Ubuntu 16.04
check_swap: Downstream Fedora patch: Prevent check_swap from returning OK, if no swap activated
Building RPMs on Amazon Linux - Add 'install-root' on line 165 of spec file


2.2.0 2017-01-19
ENHANCEMENTS
check_flexlm: if `-F <license file>` is not specified, will use `LM_LICENSE_FILE` environment var
Expand Down
2 changes: 1 addition & 1 deletion NP-VERSION-GEN
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
SRC_ROOT=`dirname $0`

NPVF=NP-VERSION-FILE
DEF_VER=2.2.0.git
DEF_VER=2.2.1.git

LF='
'
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Nagios Plugins
* For major changes between releases, read the `NEWS` file.

* For information on detailed changes that have been made or plugins
that have been added, read the `ChangeLog` file.
that have been added, read the `NEWS` file.

* Some plugins require that you have additional programs and/or
libraries installed on your system before they can be used. Plugins that
Expand Down
6 changes: 6 additions & 0 deletions THANKS.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ Christopher Maser
Christopher Schultz
Cire Iriarte
Cliff Rice
Collin Fair
Cove Schneider
Craig Leres
Craig Orsinger
Damian Myerscough
Daniel Austin
Daniel Bimschas
Daniel Leib
Daniel Scott
Daniël van Eeden
Dann Frazier
Darian Rackham
Expand Down Expand Up @@ -110,6 +112,7 @@ Garry Cook
Geert Hendrickx
Geoff Oakham
Geoff Oakham
George Paraskevas
Gerd Mueller
Gerhard Lausser
Gianluca Varisco
Expand Down Expand Up @@ -264,6 +267,7 @@ Patric Wust
Patrick Allen
Patrick McAndrew
Patrick McCormick
Patrick Uiterwijk
Paul Allen
Paul Dlug
Paul Farrall
Expand Down Expand Up @@ -328,13 +332,15 @@ Spenser Reinhardt
Stefan Meier
Stephane Chazelas
Stephane Lapie
Stephen Smoogen
Steve Greenland
Steve Hanselman
Steve Rader
Steve Rigler
Steve Weinreich
Steven Grimm
Steven Kreuzer
StoneISStephan
Stuart Webster
Stéphane Bortzmeyer
Stéphane Urbanovski
Expand Down
8 changes: 5 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(nagios-plugins,2.2.0)
AC_INIT(nagios-plugins,2.2.1)
AC_CONFIG_SRCDIR(NPTest.pm)
AC_CONFIG_FILES([gl/Makefile
nagios-plugins.spec])
Expand Down Expand Up @@ -115,7 +115,8 @@ fi
AC_SUBST(NP_RELEASE)

dnl Checks for programs.
AC_PATH_PROG(PYTHON,python)
#AC_PATH_PROG(PYTHON,python)
AX_WITH_PYTHON([2.6], [missing])
AC_PATH_PROG(SH,sh)
AC_PATH_PROG(PERL,perl)
AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
Expand Down Expand Up @@ -1553,7 +1554,7 @@ if test -n "$PATH_TO_QMAIL_QSTAT"
then
AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
else
AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
AC_MSG_WARN([Could not find qmail-qstat or equivalent])
fi

dnl SWAP info required is amount allocated/available and amount free
Expand Down Expand Up @@ -1886,6 +1887,7 @@ AC_OUTPUT(
pkg/solaris/pkginfo
po/Makefile.in
)
# plugins-python/Makefile


dnl the ones below that are commented out need to be cleaned up
Expand Down
57 changes: 57 additions & 0 deletions m4/ax_with_python.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
dnl @synopsis AX_WITH_PYTHON([minimum-version], [value-if-not-found], [path])
dnl
dnl @version 20015-01-22
dnl
dnl @author Dustin Mitchell <dustin@cs.uchicago.edu>
dnl
dnl Locates an installed Python binary, placing the result in the precious
dnl variable $PYTHON. Accepts a present $PYTHON, then --with-python, and
dnl failing that searches for python in the given path (which defaults to the
dnl system path). If python is found, $PYTHON is set to the full path of the
dnl binary; if it is not found, $PYTHON is set to VALUE-IF-NOT-FOUND, which
dnl defaults to 'python'.
dnl
AC_DEFUN([AX_WITH_PYTHON],
[
AC_ARG_VAR([PYTHON])
dnl unless PYTHON was supplied to us (as a precious variable)
if test -z "$PYTHON"
then
AC_MSG_CHECKING(for --with-python)
AC_ARG_WITH(python,
AC_HELP_STRING([--with-python=PYTHON],
[absolute path name of Python executable]),
[ if test "$withval" != "yes"
then
PYTHON="$withval"
AC_MSG_RESULT($withval)
else
AC_MSG_RESULT(no)
fi
],
[ AC_MSG_RESULT(no)
])
fi
dnl if it's still not found, check the paths, or use the fallback
if test -z "$PYTHON"
then
AC_PATH_PROG([PYTHON], python, m4_ifval([$2],[$2],[python]), $3)
fi
dnl check version if required
m4_ifvaln([$1], [
dnl do this only if we didn't fall back
if test "$PYTHON" != "m4_ifval([$2],[$2],[python])"
then
AC_MSG_CHECKING($PYTHON version >= $1)
if test `$PYTHON -c ["import sys; print sys.version[:3] >= \"$1\" and \"OK\" or \"OLD\""]` = "OK"
then
AC_MSG_RESULT(ok)
else
AC_MSG_RESULT(no)
PYTHON="$2"
fi
fi])
])
2 changes: 1 addition & 1 deletion nagios-plugins.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fi

%install
rm -rf $RPM_BUILD_ROOT
make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install
make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install install-root
%find_lang %{name}
echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
Expand Down
55 changes: 31 additions & 24 deletions plugins-scripts/check_mailq.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@
}

if ($opt_s) {
if (defined $utils::PATH_TO_SUDO && -x $utils::PATH_TO_SUDO) {
$sudo = $utils::PATH_TO_SUDO;
} else {
print "ERROR: Cannot execute sudo\n";
exit $ERRORS{'UNKNOWN'};
if ($utils::PATH_TO_SUDO ne "") {
if (-x $utils::PATH_TO_SUDO) {
$sudo = $utils::PATH_TO_SUDO;
} else {
print "ERROR: Cannot execute sudo\n";
exit $ERRORS{'UNKNOWN'};
}
}
} else {
$sudo = "";
Expand Down Expand Up @@ -309,26 +311,31 @@
elsif ( $mailq eq "postfix" ) {

## open mailq
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
exit $ERRORS{'UNKNOWN'};
}
}elsif( defined $utils::PATH_TO_MAILQ){
unless (-x $utils::PATH_TO_MAILQ) {
print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
exit $ERRORS{'UNKNOWN'};
}
} else {
print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
exit $ERRORS{'UNKNOWN'};
}

if ( defined $utils::PATH_TO_MAILQ ) {
if (-x $utils::PATH_TO_MAILQ) {
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | ")) {
print "ERROR: $utils::PATH_TO_MAILQ returned an error\n";
exit $ERRORS{'UNKNOWN'};
}
}
else {
if ( $sudo ne "" ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: $utils::PATH_TO_MAILQ is not executable with sudo by (uid $>:gid($)))\n";
exit $ERRORS{'UNKNOWN'};
}
} else {
print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($))) and sudo is not set in utils.pm\n";
exit $ERRORS{'UNKNOWN'};
}
}
} else {
print "ERROR: \$utils::PATH_TO_MAILQ is not defined in utils.pm\n";
exit $ERRORS{'UNKNOWN'};
}

@lines = reverse <MAILQ>;

# close qmail-qstat
close MAILQ;
@lines = reverse <MAILQ>;

if ( $? ) {
print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/;
Expand Down Expand Up @@ -534,7 +541,7 @@
while (<MAILQ>) {
#2006-06-22 16:00:00 282 bytes

if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{2}[0-9]+\sbytes$/) {
if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{1,2}[0-9]+\sbytes$/) {
$msg_q++ ;
}
}
Expand Down
21 changes: 11 additions & 10 deletions plugins/check_dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
*
*
*****************************************************************************/
#define IF_RECORD(label, querytype, verb_str) if (strstr (chld_out.line[i], label) && (strncmp(query_type, querytype, query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) { \
#define IF_RECORD(label, querytype, verb_str, comp_str) if (strstr (chld_out.line[i], label) && (strncmp(query_type, querytype, query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) { \
if (verbose) printf(verb_str); \
temp_buffer = rindex (chld_out.line[i], ' '); \
temp_buffer = rindex (chld_out.line[i], comp_str); \
addresses[n_addresses++] = check_new_address(temp_buffer); \
memset(query_found, '\0', sizeof(query_found)); \
strncpy(query_found, querytype, sizeof(query_found));
Expand Down Expand Up @@ -189,12 +189,12 @@ main (int argc, char **argv)
if (strstr (chld_out.line[i], "Name:"))
parse_address = TRUE;
/* begin handling types of records */
IF_RECORD("AAAA address", "-querytype=AAAA", "Found AAAA record\n") }
else IF_RECORD("exchanger =", "-querytype=MX", "Found MX record\n") }
else IF_RECORD("service =", "-querytype=SRV", "Found SRV record\n") }
else IF_RECORD("nameserver =", "-querytype=NS", "Found NS record\n") }
else IF_RECORD("dname =", "-querytype=DNAME", "Found DNAME record\n") }
else IF_RECORD("protocol =", "-querytype=WKS", "Found WKS record\n") }
IF_RECORD("AAAA address", "-querytype=AAAA", "Found AAAA record\n", ' ') }
else IF_RECORD("exchanger =", "-querytype=MX", "Found MX record\n", '=') }
else IF_RECORD("service =", "-querytype=SRV", "Found SRV record\n", ' ') }
else IF_RECORD("nameserver =", "-querytype=NS", "Found NS record\n", ' ') }
else IF_RECORD("dname =", "-querytype=DNAME", "Found DNAME record\n", ' ') }
else IF_RECORD("protocol =", "-querytype=WKS", "Found WKS record\n", ' ') }
else if (strstr (chld_out.line[i], "text =") && (strncmp(query_type, "-querytype=TXT", query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) {
if (verbose) printf("Found TXT record\n");
temp_buffer = index(chld_out.line[i], '"');
Expand All @@ -203,8 +203,9 @@ main (int argc, char **argv)
memset(query_found, '\0', sizeof(query_found));
strncpy(query_found, "-querytype=TXT", sizeof(query_found));
}

/* only matching for origin records, if requested other fields could be included at a later date */
else IF_RECORD("origin =", "-querytype=SOA", "Found SOA record\n") }
else IF_RECORD("origin =", "-querytype=SOA", "Found SOA record\n", ' ') }
/* cnames cannot use macro as we must check for accepting them separately */
else if (accept_cname && strstr (chld_out.line[i], "canonical name =") && (strncmp(query_type, "-querytype=CNAME", query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) {
if (verbose) printf("Found CNAME record\n");
Expand All @@ -220,7 +221,7 @@ main (int argc, char **argv)
strncpy(query_found, "-querytype=A", sizeof(query_found));
}
/* must be after other records with "name" as an identifier, as ptr does not spefify */
else IF_RECORD("name =", "-querytype=PTR", "Found PTR record\n") }
else IF_RECORD("name =", "-querytype=PTR", "Found PTR record\n", ' ') }
/* needed for non-query ptr\reverse lookup checks */
else if (strstr(chld_out.line[i], ".in-addr.arpa") && !query_set) {
if ((temp_buffer = strstr(chld_out.line[i], "name = ")))
Expand Down
19 changes: 12 additions & 7 deletions plugins/check_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ header_value (const char *headers, const char *header)

value_end = strchr(s, '\r');
if (!value_end) {
die (STATE_UNKNOWN, _("HTTP_UNKNOWN - Failed to parse response headers\n"));
// Turns out there's no newline after the header... So it's at the end!
value_end = s + strlen(s);
}

value_size = value_end - s;
Expand Down Expand Up @@ -1024,10 +1025,12 @@ check_http (void)
microsec_ssl = deltime (tv_temp);
elapsed_time_ssl = (double)microsec_ssl / 1.0e6;
if (check_cert == TRUE) {
result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit);
if (sd) close(sd);
np_net_ssl_cleanup();
return result;
result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit);
if (result != STATE_OK) {
np_net_ssl_cleanup();
if (sd) close(sd);
return result;
}
}
}
#endif /* HAVE_SSL */
Expand Down Expand Up @@ -1263,12 +1266,14 @@ check_http (void)
/* server errors result in a critical state */
else if (http_status >= 500) {
xasprintf (&msg, _("%s%s - "), msg, status_line);
result = STATE_CRITICAL;
if (bad_response || !server_expect_yn)
result = STATE_CRITICAL;
}
/* client errors result in a warning state */
else if (http_status >= 400) {
xasprintf (&msg, _("%s%s - "), msg, status_line);
result = max_state_alt(STATE_WARNING, result);
if (bad_response || !server_expect_yn)
result = max_state_alt(STATE_WARNING, result);
}
/* check redirected page if specified */
else if (http_status >= 300) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/check_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ process_arguments (int argc, char **argv)
}

while (1) {
c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
c = getopt_long (argc, argv, "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
longopts, &option);

if (c == -1 || c == EOF)
Expand Down
Loading

0 comments on commit 341daf6

Please sign in to comment.