Procházet zdrojové kódy

Merge branch 'release-2.2.1-rc1'

John C. Frickson před 8 roky
rodič
revize
341daf6ae3

+ 6 - 0
.gitignore

@@ -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

+ 19 - 0
NEWS

@@ -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

+ 1 - 1
NP-VERSION-GEN

@@ -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='
 '

+ 1 - 1
README

@@ -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

+ 6 - 0
THANKS.in

@@ -60,6 +60,7 @@ Christopher Maser
 Christopher Schultz
 Cire Iriarte
 Cliff Rice
+Collin Fair
 Cove Schneider
 Craig Leres
 Craig Orsinger
@@ -67,6 +68,7 @@ Damian Myerscough
 Daniel Austin
 Daniel Bimschas
 Daniel Leib
+Daniel Scott
 Daniël van Eeden
 Dann Frazier
 Darian Rackham
@@ -110,6 +112,7 @@ Garry Cook
 Geert Hendrickx
 Geoff Oakham
 Geoff Oakham
+George Paraskevas
 Gerd Mueller
 Gerhard Lausser
 Gianluca Varisco
@@ -264,6 +267,7 @@ Patric Wust
 Patrick Allen
 Patrick McAndrew
 Patrick McCormick
+Patrick Uiterwijk
 Paul Allen
 Paul Dlug
 Paul Farrall
@@ -328,6 +332,7 @@ Spenser Reinhardt
 Stefan Meier
 Stephane Chazelas
 Stephane Lapie
+Stephen Smoogen
 Steve Greenland
 Steve Hanselman
 Steve Rader
@@ -335,6 +340,7 @@ Steve Rigler
 Steve Weinreich
 Steven Grimm
 Steven Kreuzer
+StoneISStephan
 Stuart Webster
 Stéphane Bortzmeyer
 Stéphane Urbanovski

+ 5 - 3
configure.ac

@@ -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])
@@ -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)
@@ -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
@@ -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

+ 57 - 0
m4/ax_with_python.m4

@@ -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])
+])

+ 1 - 1
nagios-plugins.spec.in

@@ -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

+ 31 - 24
plugins-scripts/check_mailq.pl

@@ -59,11 +59,13 @@ if ($status){
 }
 
 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 = "";
@@ -309,26 +311,31 @@ if ($mailq eq "sendmail") {
 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",$/;
@@ -534,7 +541,7 @@ elsif ( $mailq eq "nullmailer" ) {
 	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++ ;
 	    }
 	}

+ 11 - 10
plugins/check_dns.c

@@ -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)); 
@@ -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], '"');
@@ -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");
@@ -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 = ")))

+ 12 - 7
plugins/check_http.c

@@ -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;
@@ -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 */
@@ -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) {

+ 1 - 1
plugins/check_snmp.c

@@ -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)

+ 24 - 24
plugins/check_swap.c

@@ -51,7 +51,7 @@ const char *email = "devel@nagios-plugins.org";
 # define SWAP_CONVERSION 1
 #endif
 
-int check_swap (int usp, float free_swap_mb);
+int check_swap (int usp, double free_swap_mb);
 int process_arguments (int argc, char **argv);
 int validate_arguments (void);
 void print_usage (void);
@@ -61,8 +61,8 @@ int have_warn = 0;
 int have_crit = 0;
 int warn_percent = 0;
 int crit_percent = 0;
-float warn_size_bytes = 0;
-float crit_size_bytes= 0;
+double warn_size_bytes = 0;
+double crit_size_bytes= 0;
 int verbose;
 int allswaps;
 
@@ -70,8 +70,8 @@ int
 main (int argc, char **argv)
 {
 	int percent_used, percent;
-	float total_swap_mb = 0, used_swap_mb = 0, free_swap_mb = 0;
-	float dsktotal_mb = 0, dskused_mb = 0, dskfree_mb = 0, tmp_mb = 0;
+	double total_swap_mb = 0, used_swap_mb = 0, free_swap_mb = 0;
+	double dsktotal_mb = 0, dskused_mb = 0, dskfree_mb = 0, tmp_mb = 0;
 	int result = STATE_UNKNOWN;
 	char input_buffer[MAX_INPUT_BUFFER];
 #ifdef HAVE_PROC_MEMINFO
@@ -117,7 +117,7 @@ main (int argc, char **argv)
 	}
 	fp = fopen (PROC_MEMINFO, "r");
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
-		if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%*[:] %f %f %f", &dsktotal_mb, &dskused_mb, &dskfree_mb) == 3) {
+		if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%*[:] %lf %lf %lf", &dsktotal_mb, &dskused_mb, &dskfree_mb) == 3) {
 			dsktotal_mb = dsktotal_mb / 1048576;	/* Apply conversion */
 			dskused_mb = dskused_mb / 1048576;
 			dskfree_mb = dskfree_mb / 1048576;
@@ -126,7 +126,7 @@ main (int argc, char **argv)
 			free_swap_mb += dskfree_mb;
 			if (allswaps) {
 				if (dsktotal_mb == 0)
-					percent=100.0;
+					percent=0.0;
 				else
 					percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
 				result = max_state (result, check_swap (percent, dskfree_mb));
@@ -134,9 +134,9 @@ main (int argc, char **argv)
 					xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
 			}
 		}
-		else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %f %*[k]%*[B]", str, &tmp_mb)) {
+		else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %lf %*[k]%*[B]", str, &tmp_mb)) {
 			if (verbose >= 3) {
-				printf("Got %s with %f\n", str, tmp_mb);
+				printf("Got %s with %lf\n", str, tmp_mb);
 			}
 			/* I think this part is always in Kb, so convert to mb */
 			if (strcmp ("Total", str) == 0) {
@@ -162,7 +162,7 @@ main (int argc, char **argv)
 #  ifdef _AIX
 	if (!allswaps) {
 		xasprintf(&swap_command, "%s", "/usr/sbin/lsps -s");
-		xasprintf(&swap_format, "%s", "%f%*s %f");
+		xasprintf(&swap_format, "%s", "%lf%*s %lf");
 		conv_factor = 1;
 	}
 #  endif
@@ -189,9 +189,9 @@ main (int argc, char **argv)
 		temp_buffer = strtok (input_buffer, " \n");
 		while (temp_buffer) {
 			if (strstr (temp_buffer, "blocks"))
-				sprintf (str, "%s %s", str, "%f");
+				sprintf (str, "%s %s", str, "%lf");
 			else if (strstr (temp_buffer, "dskfree"))
-				sprintf (str, "%s %s", str, "%f");
+				sprintf (str, "%s %s", str, "%lf");
 			else
 				sprintf (str, "%s %s", str, "%*s");
 			temp_buffer = strtok (NULL, " \n");
@@ -281,8 +281,8 @@ main (int argc, char **argv)
 	}
 
 	for(i=0;i<nswaps;i++){
-		dsktotal_mb = (float) tbl->swt_ent[i].ste_pages / SWAP_CONVERSION;
-		dskfree_mb = (float) tbl->swt_ent[i].ste_free /  SWAP_CONVERSION;
+		dsktotal_mb = (double) tbl->swt_ent[i].ste_pages / SWAP_CONVERSION;
+		dskfree_mb = (double) tbl->swt_ent[i].ste_free /  SWAP_CONVERSION;
 		dskused_mb = ( dsktotal_mb - dskfree_mb );
 
 		if (verbose >= 3)
@@ -323,8 +323,8 @@ main (int argc, char **argv)
 	}
 
 	for(i=0;i<nswaps;i++){
-		dsktotal_mb = (float) ent[i].se_nblks / conv_factor;
-		dskused_mb = (float) ent[i].se_inuse / conv_factor;
+		dsktotal_mb = (double) ent[i].se_nblks / conv_factor;
+		dskused_mb = (double) ent[i].se_inuse / conv_factor;
 		dskfree_mb = ( dsktotal_mb - dskused_mb );
 
 		if(allswaps && dsktotal_mb > 0){
@@ -376,10 +376,10 @@ main (int argc, char **argv)
 
 
 int
-check_swap (int usp, float free_swap_mb)
+check_swap (int usp, double free_swap_mb)
 {
 	int result = STATE_UNKNOWN;
-	float free_swap = free_swap_mb * (1024 * 1024);		/* Convert back to bytes as warn and crit specified in bytes */
+	double free_swap = free_swap_mb * (1024 * 1024);		/* Convert back to bytes as warn and crit specified in bytes */
 	if (usp >= 0 && crit_percent != 0 && usp >= (100.0 - crit_percent))
 		result = STATE_CRITICAL;
 	else if (crit_size_bytes > 0 && free_swap <= crit_size_bytes)
@@ -424,13 +424,13 @@ process_arguments (int argc, char **argv)
 		switch (c) {
 		case 'w':									/* warning size threshold */
 			if (is_intnonneg (optarg)) {
-				warn_size_bytes = (float) atoi (optarg);
+				warn_size_bytes = (double) atoi (optarg);
 				have_warn = TRUE;
 				break;
 			}
 			else if (strstr (optarg, ",") &&
 							 strstr (optarg, "%") &&
-							 sscanf (optarg, "%f,%d%%", &warn_size_bytes, &warn_percent) == 2) {
+							 sscanf (optarg, "%lf,%d%%", &warn_size_bytes, &warn_percent) == 2) {
 				warn_size_bytes = floorf(warn_size_bytes);
 				have_warn = TRUE;
 				break;
@@ -445,13 +445,13 @@ process_arguments (int argc, char **argv)
 			}
 		case 'c':									/* critical size threshold */
 			if (is_intnonneg (optarg)) {
-				crit_size_bytes = (float) atoi (optarg);
+				crit_size_bytes = (double) atoi (optarg);
 				have_crit = TRUE;
 				break;
 			}
 			else if (strstr (optarg, ",") &&
 							 strstr (optarg, "%") &&
-							 sscanf (optarg, "%f,%d%%", &crit_size_bytes, &crit_percent) == 2) {
+							 sscanf (optarg, "%lf,%d%%", &crit_size_bytes, &crit_percent) == 2) {
 				crit_size_bytes = floorf(crit_size_bytes);
 				have_crit = TRUE;
 				break;
@@ -495,12 +495,12 @@ process_arguments (int argc, char **argv)
 	if (c == argc)
 		return validate_arguments ();
 	if (warn_size_bytes == 0 && is_intnonneg (argv[c]))
-		warn_size_bytes = (float) atoi (argv[c++]);
+		warn_size_bytes = (double) atoi (argv[c++]);
 
 	if (c == argc)
 		return validate_arguments ();
 	if (crit_size_bytes == 0 && is_intnonneg (argv[c]))
-		crit_size_bytes = (float) atoi (argv[c++]);
+		crit_size_bytes = (double) atoi (argv[c++]);
 
 	return validate_arguments ();
 }

+ 23 - 23
plugins/check_uptime.c

@@ -129,20 +129,20 @@ int getuptime () {
 static int process_arguments (int argc, char **argv) {
 
 	int c;
-        int escape = 0;
-        char *temp;
+	int escape = 0;
+	char *temp;
 	
-        int option = 0;
-        static struct option longopts[] = {
-                {"critical", required_argument, 0, 'c'},
-                {"warning", required_argument, 0, 'w'},
-    		{"timeout", required_argument, 0, 't'},
-                {"timeunit", required_argument, 0, 'u'},
-                {"verbose", no_argument, 0, 'v'},
-                {"version", no_argument, 0, 'V'},
-                {"help", no_argument, 0, 'h'},
-                {0, 0, 0, 0}
-        };
+	int option = 0;
+	static struct option longopts[] = {
+		{"critical", required_argument, 0, 'c'},
+		{"warning", required_argument, 0, 'w'},
+		{"timeout", required_argument, 0, 't'},
+		{"timeunit", required_argument, 0, 'u'},
+		{"verbose", no_argument, 0, 'v'},
+		{"version", no_argument, 0, 'V'},
+		{"help", no_argument, 0, 'h'},
+		{0, 0, 0, 0}
+	};
 
 	while ( 1 ) {
 
@@ -162,9 +162,9 @@ static int process_arguments (int argc, char **argv) {
 					printf("Verbose mode enabled\n");
 				}
 				break;
-    			case 'V':
-      				print_revision (progname, NP_VERSION);
-      				exit (STATE_OK);
+			case 'V':
+				print_revision (progname, NP_VERSION);
+				exit (STATE_OK);
 			case 'u':
 				timeunit = optarg;
 				break;
@@ -221,7 +221,7 @@ void print_help (void) {
 	print_revision ( progname, NP_VERSION );
 
 	printf ( COPYRIGHT, copyright, developer, email );
-	printf ( "%s\n", _("This plugin checks the system uptime and alerts if less than the threshold.") );
+	printf ( "%s\n", _("This plugin checks the system uptime and alerts if more than the threshold.") );
 	printf ( "%s\n", _("Threshold unit of measurement specified with \"-u\".") );
 	printf ( "%s\n", _("\"-u\" switch supports: seconds|minutes|hours|days.") );
 
@@ -229,13 +229,13 @@ void print_help (void) {
 	printf ( UT_HELP_VRSN );
 	printf ( UT_EXTRA_OPTS );
 
-        printf ( "%s\n", _("-t, Plugin timeout, default 10 seconds") );
-        printf ( "%s\n", _("-c, Critcal threshold") );
-	printf ( "%s\n", _("-w, Warning threshold") );
 	printf ( "%s\n", _("-u, Time unit of measurement (seconds|minutes|hours|days) (default: minutes)") );
-        printf ( "%s\n", _("-vvv, Enable verbose output") );
-        //printf ( "%s\n", _("-h, Print help and usage") );
+	printf ( "%s\n", _("-w, Warning threshold") );
+	printf ( "%s\n", _("-c, Critcal threshold") );
+	printf ( "%s\n", _("-t, Plugin timeout, default 10 seconds") );
+	printf ( "%s\n", _("-vvv, Enable verbose output") );
+	//printf ( "%s\n", _("-h, Print help and usage") );
 
-       printf ( UT_SUPPORT );
+	printf ( UT_SUPPORT );
 
 } // end print_help

+ 4 - 4
plugins/check_users.c

@@ -222,10 +222,10 @@ process_arguments (int argc, char **argv)
 	/* this will abort in case of invalid ranges */
 	set_thresholds (&thlds, warning_range, critical_range);
 
-	if (thlds->warning->end <= 0)
-		usage4 (_("Warning threshold must be a positive integer"));
-	if (thlds->critical->end <= 0)
-		usage4 (_("Critical threshold must be a positive integer"));
+	if (!thlds->warning || thlds->warning->end < 0)
+		usage4 (_("Warning threshold must be zero or greater"));
+	if (!thlds->critical || thlds->critical->end < 0)
+		usage4 (_("Critical threshold must be zero or greater"));
 
 	return OK;
 }

+ 2 - 2
plugins/netutils.c

@@ -42,8 +42,8 @@ int address_family = AF_INET;
 void
 socket_timeout_alarm_handler (int sig)
 {
-	const char msg1[] = " - Socket timeout";
-	const char msg2[] = " - Abnormal timeout";
+	const char msg1[] = " - Socket timeout\n";
+	const char msg2[] = " - Abnormal timeout\n";
 	switch(timeout_state) {
 		case STATE_OK:
 			write(STDOUT_FILENO, "OK", 2);

+ 4 - 1
plugins/sslutils.c

@@ -211,6 +211,9 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){
 	int time_remaining;
 	time_t tm_t;
 
+	// Prefix whatever we're about to print with SSL
+	printf("SSL ");
+
 	certificate=SSL_get_peer_certificate(s);
 	if (!certificate) {
 		printf("%s\n",_("CRITICAL - Cannot retrieve server certificate."));
@@ -301,7 +304,7 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){
 		else
 			status = STATE_CRITICAL;
 	} else {
-		printf(_("OK - Certificate '%s' will expire on %s.\n"), cn, timestamp);
+		printf(_("OK - Certificate '%s' will expire on %s. "), cn, timestamp);
 		status = STATE_OK;
 	}
 	X509_free(certificate);