Explorar o código

Merge branch 'master' into 720-check_snmp-int-bug

Sebastian Wolf %!s(int64=2) %!d(string=hai) anos
pai
achega
71efa8228d
Modificáronse 4 ficheiros con 19 adicións e 6 borrados
  1. 4 1
      NEWS
  2. 2 0
      THANKS.in
  3. 3 2
      plugins-scripts/check_ntp.pl
  4. 10 3
      plugins/check_snmp.c

+ 4 - 1
NEWS

@@ -1,7 +1,10 @@
 This file documents the major additions and syntax changes between releases.
 
-2.4.7 2023-10-30
+2.4.7 2023-11-07
 	FIXES
+	check_ntp.pl: Fix warning/critical threshold information missing from performance data output (#735)
+	check_ntp.pl: Fix issues when NTP server has a positive time offset (#734)
+	check_snmp: Fixed issue where plugin returned OK for missing OID (#679)
 	check_snmp: Fixed issue where OID name with numeric data was misinterpreted as OID value (#720)
 
 2.4.6 2023-08-01

+ 2 - 0
THANKS.in

@@ -93,6 +93,7 @@ Daniel Scott
 Daniël van Eeden
 Dann Frazier
 Darian Rackham
+DarkNinja77
 Dave Viner
 David Alden
 David Croft
@@ -143,6 +144,7 @@ Gianluca Varisco
 gino0631
 Grant Byers
 Greg Bowser
+Griffin Westerman
 Guenther Mair
 Guillaume Rousse
 Gunnar Beutner

+ 3 - 2
plugins-scripts/check_ntp.pl

@@ -214,7 +214,7 @@ while (<NTPDATE>) {
 		$stratum = $1;
 	}
 	
-	if (/(offset|adjust)\s+([-.\d]+)/i) {
+	if (/(offset|adjust)\s+([-+.\d]+)/i) {
 		$offset = $2;
 
 		# An offset of 0.000000 with an error is probably bogus. Actually,
@@ -427,7 +427,8 @@ if ($ntpdate_error != $ERRORS{'OK'}) {
 
 foreach my $key (keys %ERRORS) {
 	if ($state==$ERRORS{$key}) {
-		print ("NTP $key: $answer|offset=$offset");
+ 		$offset =~ s/\+//;
+		print ("NTP $key: $answer|offset=".$offset."s;$owarn;$ocrit;;");
 		if ($have_ntpq) {
 			print (", jitter=" . $jitter/1000 .	",peer_stratum=$stratum");
 		}

+ 10 - 3
plugins/check_snmp.c

@@ -94,6 +94,7 @@ void print_usage (void);
 void print_help (void);
 
 #include "regex.h"
+#include <ctype.h>
 char regex_expect[MAX_INPUT_BUFFER] = "";
 regex_t preg;
 regmatch_t pmatch[10];
@@ -203,7 +204,7 @@ main (int argc, char **argv)
 	char *previous_string=NULL;
 	char *ap=NULL;
 	char *state_string=NULL;
-	size_t response_length, current_length, string_length;
+	size_t response_length, current_length, string_length, show_length;
 	char *temp_string=NULL;
 	char *quote_string=NULL;
 	time_t current_time;
@@ -488,9 +489,15 @@ main (int argc, char **argv)
 			show = strpbrk (show, "-0123456789");
 			is_ticks = 1;
 		}
-		else
+		else {
 			show = response;
-
+			show_length = strlen(show);
+			for (int i = 0; i < show_length; i++){
+				if (isspace(show[i])){
+					die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show);
+				}
+			}
+		}
 		iresult = STATE_DEPENDENT;
 
 		/* Process this block for numeric comparisons */