summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 958162b)
raw | patch | inline | side by side (parent: 958162b)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 20 Dec 2006 22:33:29 +0000 (22:33 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 20 Dec 2006 22:33:29 +0000 (22:33 +0000) |
Fixed redirection test. Added extra tests for funny syntax when checking
certificates, updated help for more common syntax
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1555 f882894a-f735-0410-b71e-b25c423dba1c
certificates, updated help for more common syntax
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1555 f882894a-f735-0410-b71e-b25c423dba1c
CHANGES | patch | blob | history | |
THANKS.in | patch | blob | history | |
plugins/check_http.c | patch | blob | history | |
plugins/t/check_http.t | patch | blob | history |
index ea461dbb4add3b623ec1038ebc2de6c6f97ed479..3f5c0a69fd4f0a4f746d2a85cb676f5deeebd895 100644 (file)
--- a/CHANGES
+++ b/CHANGES
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 ae5ba1fb5828718be302c7acb1c67dfd4fb02bc9..031cc4a87c3855445590e7574c76528ec9c77021 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
Pawel Malachowski
Duncan Ferguson
Dick van den Burg
+Matthias Eble
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 05ae55b85f0935801cf8897e714ecd00b4c163f9..203ebe5c07654ecd08bdb999ed3b2b4561d7154d 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
#define HTTP_URL "/"
#define CRLF "\r\n"
-char timestamp[17] = "";
int specify_port = FALSE;
int server_port = HTTP_PORT;
char server_port_text[6] = "";
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,
/* 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
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) */
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)
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);
}
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);
}
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;
#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
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 21ac0f7a0b78388ce6a9386551f0c0b1b6b97cdf..5b678861aaf6dca8df91a92e6929839c1ee031f9 100644 (file)
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
use Test::More;
use NPTest;
-plan tests => 22;
+plan tests => 26;
my $successOutput = '/OK.*HTTP.*second/';
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");
$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");