Przeglądaj źródła

Merge branch 'master' into 526-ntp-locale

Sebastian Wolf 6 lat temu
rodzic
commit
7dad82c2c1

+ 5 - 0
NEWS

@@ -5,6 +5,11 @@ This file documents the major additions and syntax changes between releases.
 	check_http: Fix host:port syntax when using -H (Isaac White)
 	check_http: Fix host:port syntax when using -H (Isaac White)
 	check_ntp_peer: Fixed improper performance data by setting LC_NUMERIC to 'C' (#526)
 	check_ntp_peer: Fixed improper performance data by setting LC_NUMERIC to 'C' (#526)
 	check_ntp_time: Fixed improper performance data by setting LC_NUMERIC to 'C' (#526)
 	check_ntp_time: Fixed improper performance data by setting LC_NUMERIC to 'C' (#526)
+	check_mailq: Fix nullmailer regular expression to recognize minutes and seconds properly (#522)
+	check_icmp: Fix incorrect status when run against multiple hosts (#520)
+	build: Fix broken builds on some systems, including Homebrew (#508)
+	perl dependencies: updated the included Module::Build to work with newer versions of perl (#505)
+	check_icmp: All performance data tags should show when packet loss is 100% (#510)
 
 
 2.3.1 2019-12-09
 2.3.1 2019-12-09
 	FIXES
 	FIXES

BIN
perlmods/Module-Build-0.4007.tar.gz


+ 3 - 3
plugins-root/Makefile.am

@@ -26,7 +26,7 @@ EXTRA_PROGRAMS = pst3
 
 
 EXTRA_DIST = t pst3.c
 EXTRA_DIST = t pst3.c
 
 
-BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a $(SSLLIBS)
+BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
 NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
 NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
 NETLIBS = $(NETOBJS) $(SOCKETLIBS)
 NETLIBS = $(NETOBJS) $(SOCKETLIBS)
 
 
@@ -88,8 +88,8 @@ install-exec-local: $(noinst_PROGRAMS)
 
 
 ##############################################################################
 ##############################################################################
 # the actual targets
 # the actual targets
-check_dhcp_LDADD = @LTLIBINTL@ $(NETLIBS)
-check_icmp_LDADD = @LTLIBINTL@ $(NETLIBS) $(SOCKETLIBS)
+check_dhcp_LDADD = @LTLIBINTL@ $(NETLIBS) $(SSLLIBS)
+check_icmp_LDADD = @LTLIBINTL@ $(NETLIBS) $(SOCKETLIBS) $(SSLLIBS)
 
 
 # -m64 needed at compiler and linker phase
 # -m64 needed at compiler and linker phase
 pst3_CFLAGS = @PST3CFLAGS@
 pst3_CFLAGS = @PST3CFLAGS@

+ 6 - 5
plugins-root/check_icmp.c

@@ -1361,6 +1361,7 @@ static void finish(int sig) {
   status = STATE_OK;
   status = STATE_OK;
   host = list;
   host = list;
   while (host) {
   while (host) {
+    this_status = STATE_OK;
     if (!host->icmp_recv) {
     if (!host->icmp_recv) {
       /* rta 0 is ofcourse not entirely correct, but will still show up
       /* rta 0 is ofcourse not entirely correct, but will still show up
        * conspicuosly as missing entries in perfparse and cacti */
        * conspicuosly as missing entries in perfparse and cacti */
@@ -1592,7 +1593,7 @@ static void finish(int sig) {
     if (debug) {
     if (debug) {
       puts("");
       puts("");
     }
     }
-    if (rta_mode && host->pl < 100) {
+    if (rta_mode) {
       printf("%srta=%0.3fms;%0.3f;%0.3f;0; ",
       printf("%srta=%0.3fms;%0.3f;%0.3f;0; ",
              (targets > 1) ? host->name : "", (float)host->rta / 1000,
              (targets > 1) ? host->name : "", (float)host->rta / 1000,
              (float)warn.rta / 1000, (float)crit.rta / 1000);
              (float)warn.rta / 1000, (float)crit.rta / 1000);
@@ -1601,12 +1602,12 @@ static void finish(int sig) {
       printf("%spl=%u%%;%u;%u;0;100 ", (targets > 1) ? host->name : "",
       printf("%spl=%u%%;%u;%u;0;100 ", (targets > 1) ? host->name : "",
              host->pl, warn.pl, crit.pl);
              host->pl, warn.pl, crit.pl);
     }
     }
-    if (rta_mode && host->pl < 100) {
+    if (rta_mode) {
       printf("%srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ",
       printf("%srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ",
              (targets > 1) ? host->name : "", (float)host->rtmax / 1000,
              (targets > 1) ? host->name : "", (float)host->rtmax / 1000,
              (targets > 1) ? host->name : "", (float)host->rtmin / 1000);
              (targets > 1) ? host->name : "", (float)host->rtmin / 1000);
     }
     }
-    if (jitter_mode && host->pl < 100) {
+    if (jitter_mode) {
       printf("%sjitter_avg=%0.3fms;%0.3f;%0.3f;0; %sjitter_max=%0.3fms;;;; "
       printf("%sjitter_avg=%0.3fms;%0.3f;%0.3f;0; %sjitter_max=%0.3fms;;;; "
              "%sjitter_min=%0.3fms;;;; ",
              "%sjitter_min=%0.3fms;;;; ",
              (targets > 1) ? host->name : "", (float)host->jitter,
              (targets > 1) ? host->name : "", (float)host->jitter,
@@ -1614,11 +1615,11 @@ static void finish(int sig) {
              (targets > 1) ? host->name : "", (float)host->jitter_max / 1000,
              (targets > 1) ? host->name : "", (float)host->jitter_max / 1000,
              (targets > 1) ? host->name : "", (float)host->jitter_min / 1000);
              (targets > 1) ? host->name : "", (float)host->jitter_min / 1000);
     }
     }
-    if (mos_mode && host->pl < 100) {
+    if (mos_mode) {
       printf("%smos=%0.1f;%0.1f;%0.1f;0;5 ", (targets > 1) ? host->name : "",
       printf("%smos=%0.1f;%0.1f;%0.1f;0;5 ", (targets > 1) ? host->name : "",
              (float)host->mos, (float)warn.mos, (float)crit.mos);
              (float)host->mos, (float)warn.mos, (float)crit.mos);
     }
     }
-    if (score_mode && host->pl < 100) {
+    if (score_mode) {
       printf("%sscore=%u;%u;%u;0;100 ", (targets > 1) ? host->name : "",
       printf("%sscore=%u;%u;%u;0;100 ", (targets > 1) ? host->name : "",
              (int)host->score, (int)warn.score, (int)crit.score);
              (int)host->score, (int)warn.score, (int)crit.score);
     }
     }

+ 1 - 1
plugins-scripts/check_mailq.pl

@@ -587,7 +587,7 @@ elsif ( $mailq eq "nullmailer" ) {
 	while (<MAILQ>) {
 	while (<MAILQ>) {
 	    #2006-06-22 16:00:00  282 bytes
 	    #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{1,2}[0-9]+\sbytes$/) {
+	    if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]\s{1,2}[0-9]+\sbytes$/) {
 		$msg_q++ ;
 		$msg_q++ ;
 	    }
 	    }
 	}
 	}

+ 39 - 5
plugins/check_http.c

@@ -608,9 +608,11 @@ enable_ssl:
 
 
 
 
 
 
-/* Returns 1 if we're done processing the document body; 0 to keep going */
+/* Returns 0 if we're still retrieving the headers.
+ * Otherwise, returns the length of the header (not including the final newlines)
+ */
 static int
 static int
-document_headers_done (char *full_page)
+document_headers_done (const char *full_page)
 {
 {
     const char *body;
     const char *body;
 
 
@@ -622,8 +624,7 @@ document_headers_done (char *full_page)
     if (!*body)
     if (!*body)
         return 0;  /* haven't read end of headers yet */
         return 0;  /* haven't read end of headers yet */
 
 
-    full_page[body - full_page] = 0;
-    return 1;
+    return body - full_page;
 }
 }
 
 
 static time_t
 static time_t
@@ -1013,6 +1014,10 @@ check_http (void)
     char *page;
     char *page;
     char *auth;
     char *auth;
     int http_status;
     int http_status;
+    int header_end;
+    int content_length;
+    int content_start;
+    int seen_length;
     int i = 0;
     int i = 0;
     size_t pagesize = 0;
     size_t pagesize = 0;
     char *full_page;
     char *full_page;
@@ -1195,11 +1200,40 @@ check_http (void)
         full_page = full_page_new;
         full_page = full_page_new;
         pagesize += i;
         pagesize += i;
 
 
-        if (no_body && document_headers_done (full_page)) {
+        header_end = document_headers_done(full_page);
+        if (header_end) {
             i = 0;
             i = 0;
             break;
             break;
         }
         }
     }
     }
+
+    if (no_body) {
+        full_page[header_end] = '\0';
+    }
+    else {
+        content_length = get_content_length(full_page);
+
+        content_start = header_end + 1;
+        while (full_page[content_start] == '\n' || full_page[content_start] == '\r') {
+            content_start += 1;
+        }
+        seen_length = pagesize - content_start;
+        /* Continue receiving the body until content-length is met */
+        while (seen_length < content_length
+            && (i = my_recv(buffer, MAX_INPUT_BUFFER-1) > 0)) {
+
+            buffer[i] = '\0';
+
+            if ((full_page_new = realloc(full_page, pagesize + i + 1)) == NULL)
+                die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate memory for full_page\n"));
+            memmove(&full_page_new[pagesize], buffer, i);
+            full_page = full_page_new;
+
+            pagesize += i;
+            seen_length = pagesize - content_start;
+        }
+    }
+
     microsec_transfer = deltime (tv_temp);
     microsec_transfer = deltime (tv_temp);
     elapsed_time_transfer = (double)microsec_transfer / 1.0e6;
     elapsed_time_transfer = (double)microsec_transfer / 1.0e6;