aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--THANKS.in1
-rw-r--r--plugins/check_http.c38
-rw-r--r--plugins/t/check_http.t12
4 files changed, 27 insertions, 25 deletions
diff --git a/CHANGES b/CHANGES
index ea461dbb..3f5c0a69 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,7 @@ This file documents the major additions and syntax changes between releases.
Fixed compile problems with *BSD re: alloca.h
Fixed Solaris problems with check_swap (tested on Solaris 9)
Fixed check_swap for HP/UX where swapinfo command was incorrect
+ Fixed check_disk inode threshold checks, regressed at r1.4.4.
1.4.5
Fixed bug in perl's is_hostname routine
diff --git a/THANKS.in b/THANKS.in
index ae5ba1fb..031cc4a8 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -203,3 +203,4 @@ Florian Gleixner
Pawel Malachowski
Duncan Ferguson
Dick van den Burg
+Matthias Eble
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 05ae55b8..203ebe5c 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -88,7 +88,6 @@ struct timeval tv;
#define HTTP_URL "/"
#define CRLF "\r\n"
-char timestamp[17] = "";
int specify_port = FALSE;
int server_port = HTTP_PORT;
char server_port_text[6] = "";
@@ -147,13 +146,6 @@ main (int argc, char **argv)
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
- if (strstr (timestamp, ":")) {
- if (strstr (server_url, "?"))
- asprintf (&server_url, "%s&%s", server_url, timestamp);
- else
- asprintf (&server_url, "%s?%s", server_url, timestamp);
- }
-
if (display_html == TRUE)
printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
use_ssl ? "https" : "http", host_name,
@@ -861,7 +853,7 @@ check_http (void)
/* return a CRITICAL status if we couldn't read any data */
if (pagesize == (size_t) 0)
- die (STATE_CRITICAL, _("No data received %s\n"), timestamp);
+ die (STATE_CRITICAL, _("No data received from host\n"));
/* close the connection */
#ifdef HAVE_SSL
@@ -967,8 +959,8 @@ check_http (void)
microsec = deltime (tv);
elapsed_time = (double)microsec / 1.0e6;
die (onredirect,
- _(" - %s - %.3f second response time %s%s|%s %s\n"),
- status_line, elapsed_time, timestamp,
+ _(" - %s - %.3f second response time %s|%s %s\n"),
+ status_line, elapsed_time,
(display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (pagesize));
} /* end if (http_status >= 300) */
@@ -983,8 +975,8 @@ check_http (void)
microsec = deltime (tv);
elapsed_time = (double)microsec / 1.0e6;
asprintf (&msg,
- _("HTTP WARNING: %s - %.3f second response time %s%s|%s %s\n"),
- status_line, elapsed_time, timestamp,
+ _("HTTP WARNING: %s - %.3f second response time %s|%s %s\n"),
+ status_line, elapsed_time,
(display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (pagesize));
if (check_critical_time == TRUE && elapsed_time > critical_time)
@@ -997,9 +989,9 @@ check_http (void)
if (strlen (string_expect)) {
if (strstr (page, string_expect)) {
- printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
+ printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"),
status_line, elapsed_time,
- timestamp, (display_html ? "</A>" : ""),
+ (display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (pagesize));
exit (STATE_OK);
}
@@ -1014,9 +1006,9 @@ check_http (void)
if (strlen (regexp)) {
errcode = regexec (&preg, page, REGS, pmatch, 0);
if ((errcode == 0 && invert_regex == 0) || (errcode == REG_NOMATCH && invert_regex == 1)) {
- printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
+ printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"),
status_line, elapsed_time,
- timestamp, (display_html ? "</A>" : ""),
+ (display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (pagesize));
exit (STATE_OK);
}
@@ -1052,9 +1044,9 @@ check_http (void)
exit (STATE_WARNING);
}
/* We only get here if all tests have been passed */
- asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s%s|%s %s\n"),
+ asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s|%s %s\n"),
status_line, page_len, elapsed_time,
- timestamp, (display_html ? "</A>" : ""),
+ (display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (page_len));
die (STATE_OK, "%s", msg);
return STATE_UNKNOWN;
@@ -1263,9 +1255,9 @@ print_help (void)
#ifdef HAVE_SSL
printf (" %s\n", "-S, --ssl");
- printf (" %s\n", _("Connect via SSL"));
+ printf (" %s\n", _("Connect via SSL. Port defaults to 443"));
printf (" %s\n", "-C, --certificate=INTEGER");
- printf (" %s\n", _("Minimum number of days a certificate has to be valid."));
+ printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443"));
printf (" %s\n", _("(when this option is used the url is not checked.)\n"));
#endif
@@ -1329,13 +1321,13 @@ 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 (_("Examples:"));
- printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl www.verisign.com");
+ 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,"));
printf (" %s\n", _("a STATE_OK will be returned. When the server returns its content but exceeds"));
printf (" %s\n", _("the 5-second threshold, a STATE_WARNING will be returned. When an error occurs,"));
printf (" %s\n\n", _("a STATE_CRITICAL will be returned."));
- printf (" %s\n\n", "CHECK CERTIFICATE: check_http www.verisign.com -C 14");
+ printf (" %s\n\n", "CHECK CERTIFICATE: check_http -H www.verisign.com -C 14");
printf (" %s\n", _("When the certificate of 'www.verisign.com' is valid for more than 14 days,"));
printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than"));
printf (" %s\n", _("14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when"));
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 21ac0f7a..5b678861 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -9,7 +9,7 @@ use strict;
use Test::More;
use NPTest;
-plan tests => 22;
+plan tests => 26;
my $successOutput = '/OK.*HTTP.*second/';
@@ -68,6 +68,14 @@ cmp_ok( $res->return_code, '==', 0, "Checking certificate for www.verisign.com")
like ( $res->output, '/Certificate will expire on/', "Output OK" );
my $saved_cert_output = $res->output;
+$res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
+is( $res->return_code, 0, "Old syntax for cert checking okay" );
+is( $res->output, $saved_cert_output, "Same output as new syntax" );
+
+$res = NPTest->testCmd( "./check_http -H www.verisign.com -C 1" );
+is( $res->return_code, 0, "Updated syntax for cert checking okay" );
+is( $res->output, $saved_cert_output, "Same output as new syntax" );
+
$res = NPTest->testCmd( "./check_http -C 1 www.verisign.com" );
cmp_ok( $res->output, 'eq', $saved_cert_output, "--ssl option automatically added");
@@ -96,6 +104,6 @@ like ( $res->output, "/pattern found/", "Error message says 'pattern found'");
$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs' --invert-regex" );
cmp_ok( $res->return_code, "==", 0, "And also when not found");
-$res = NPTest->testCmd( "./check_http -H www.worldfirefoxday.com -f follow" );
+$res = NPTest->testCmd( "./check_http -H www.mozilla.com -u /firefox -f follow" );
is( $res->return_code, 0, "Redirection based on location is okay");