diff options
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 185 |
1 files changed, 157 insertions, 28 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 9231a55..1576601 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1,40 +1,40 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | * |
3 | * Nagios check_http plugin | 3 | * Nagios check_http plugin |
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 1999-2008 Nagios Plugins Development Team | 6 | * Copyright (c) 1999-2013 Nagios Plugins Development Team |
7 | * | 7 | * |
8 | * Description: | 8 | * Description: |
9 | * | 9 | * |
10 | * This file contains the check_http plugin | 10 | * This file contains the check_http plugin |
11 | * | 11 | * |
12 | * This plugin tests the HTTP service on the specified host. It can test | 12 | * This plugin tests the HTTP service on the specified host. It can test |
13 | * normal (http) and secure (https) servers, follow redirects, search for | 13 | * normal (http) and secure (https) servers, follow redirects, search for |
14 | * strings and regular expressions, check connection times, and report on | 14 | * strings and regular expressions, check connection times, and report on |
15 | * certificate expiration times. | 15 | * certificate expiration times. |
16 | * | 16 | * |
17 | * | 17 | * |
18 | * This program is free software: you can redistribute it and/or modify | 18 | * This program is free software: you can redistribute it and/or modify |
19 | * it under the terms of the GNU General Public License as published by | 19 | * it under the terms of the GNU General Public License as published by |
20 | * the Free Software Foundation, either version 3 of the License, or | 20 | * the Free Software Foundation, either version 3 of the License, or |
21 | * (at your option) any later version. | 21 | * (at your option) any later version. |
22 | * | 22 | * |
23 | * This program is distributed in the hope that it will be useful, | 23 | * This program is distributed in the hope that it will be useful, |
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
26 | * GNU General Public License for more details. | 26 | * GNU General Public License for more details. |
27 | * | 27 | * |
28 | * You should have received a copy of the GNU General Public License | 28 | * You should have received a copy of the GNU General Public License |
29 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 29 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | * | 30 | * |
31 | * | 31 | * |
32 | *****************************************************************************/ | 32 | *****************************************************************************/ |
33 | 33 | ||
34 | /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ | 34 | /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ |
35 | 35 | ||
36 | const char *progname = "check_http"; | 36 | const char *progname = "check_http"; |
37 | const char *copyright = "1999-2011"; | 37 | const char *copyright = "1999-2013"; |
38 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 38 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
39 | 39 | ||
40 | #include "common.h" | 40 | #include "common.h" |
@@ -43,7 +43,6 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
43 | #include "base64.h" | 43 | #include "base64.h" |
44 | #include <ctype.h> | 44 | #include <ctype.h> |
45 | 45 | ||
46 | #define INPUT_DELIMITER ";" | ||
47 | #define STICKY_NONE 0 | 46 | #define STICKY_NONE 0 |
48 | #define STICKY_HOST 1 | 47 | #define STICKY_HOST 1 |
49 | #define STICKY_PORT 2 | 48 | #define STICKY_PORT 2 |
@@ -85,6 +84,7 @@ int errcode; | |||
85 | int invert_regex = 0; | 84 | int invert_regex = 0; |
86 | 85 | ||
87 | struct timeval tv; | 86 | struct timeval tv; |
87 | struct timeval tv_temp; | ||
88 | 88 | ||
89 | #define HTTP_URL "/" | 89 | #define HTTP_URL "/" |
90 | #define CRLF "\r\n" | 90 | #define CRLF "\r\n" |
@@ -100,7 +100,9 @@ char *user_agent; | |||
100 | int server_url_length; | 100 | int server_url_length; |
101 | int server_expect_yn = 0; | 101 | int server_expect_yn = 0; |
102 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | 102 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; |
103 | char header_expect[MAX_INPUT_BUFFER] = ""; | ||
103 | char string_expect[MAX_INPUT_BUFFER] = ""; | 104 | char string_expect[MAX_INPUT_BUFFER] = ""; |
105 | char output_header_search[30] = ""; | ||
104 | char output_string_search[30] = ""; | 106 | char output_string_search[30] = ""; |
105 | char *warning_thresholds = NULL; | 107 | char *warning_thresholds = NULL; |
106 | char *critical_thresholds = NULL; | 108 | char *critical_thresholds = NULL; |
@@ -115,6 +117,7 @@ int followsticky = STICKY_NONE; | |||
115 | int use_ssl = FALSE; | 117 | int use_ssl = FALSE; |
116 | int use_sni = FALSE; | 118 | int use_sni = FALSE; |
117 | int verbose = FALSE; | 119 | int verbose = FALSE; |
120 | int show_extended_perfdata = FALSE; | ||
118 | int sd; | 121 | int sd; |
119 | int min_page_len = 0; | 122 | int min_page_len = 0; |
120 | int max_page_len = 0; | 123 | int max_page_len = 0; |
@@ -124,6 +127,8 @@ char *http_method; | |||
124 | char *http_post_data; | 127 | char *http_post_data; |
125 | char *http_content_type; | 128 | char *http_content_type; |
126 | char buffer[MAX_INPUT_BUFFER]; | 129 | char buffer[MAX_INPUT_BUFFER]; |
130 | char *client_cert = NULL; | ||
131 | char *client_privkey = NULL; | ||
127 | 132 | ||
128 | int process_arguments (int, char **); | 133 | int process_arguments (int, char **); |
129 | int check_http (void); | 134 | int check_http (void); |
@@ -131,6 +136,11 @@ void redir (char *pos, char *status_line); | |||
131 | int server_type_check(const char *type); | 136 | int server_type_check(const char *type); |
132 | int server_port_check(int ssl_flag); | 137 | int server_port_check(int ssl_flag); |
133 | char *perfd_time (double microsec); | 138 | char *perfd_time (double microsec); |
139 | char *perfd_time_connect (double microsec); | ||
140 | char *perfd_time_ssl (double microsec); | ||
141 | char *perfd_time_firstbyte (double microsec); | ||
142 | char *perfd_time_headers (double microsec); | ||
143 | char *perfd_time_transfer (double microsec); | ||
134 | char *perfd_size (int page_len); | 144 | char *perfd_size (int page_len); |
135 | void print_help (void); | 145 | void print_help (void); |
136 | void print_usage (void); | 146 | void print_usage (void); |
@@ -170,7 +180,14 @@ main (int argc, char **argv) | |||
170 | return result; | 180 | return result; |
171 | } | 181 | } |
172 | 182 | ||
173 | 183 | /* check whether a file exists */ | |
184 | void | ||
185 | test_file (char *path) | ||
186 | { | ||
187 | if (access(path, R_OK) == 0) | ||
188 | return; | ||
189 | usage2 (_("file does not exist or is not readable"), path); | ||
190 | } | ||
174 | 191 | ||
175 | /* process command-line arguments */ | 192 | /* process command-line arguments */ |
176 | int | 193 | int |
@@ -199,6 +216,7 @@ process_arguments (int argc, char **argv) | |||
199 | {"port", required_argument, 0, 'p'}, | 216 | {"port", required_argument, 0, 'p'}, |
200 | {"authorization", required_argument, 0, 'a'}, | 217 | {"authorization", required_argument, 0, 'a'}, |
201 | {"proxy_authorization", required_argument, 0, 'b'}, | 218 | {"proxy_authorization", required_argument, 0, 'b'}, |
219 | {"header-string", required_argument, 0, 'd'}, | ||
202 | {"string", required_argument, 0, 's'}, | 220 | {"string", required_argument, 0, 's'}, |
203 | {"expect", required_argument, 0, 'e'}, | 221 | {"expect", required_argument, 0, 'e'}, |
204 | {"regex", required_argument, 0, 'r'}, | 222 | {"regex", required_argument, 0, 'r'}, |
@@ -207,6 +225,8 @@ process_arguments (int argc, char **argv) | |||
207 | {"linespan", no_argument, 0, 'l'}, | 225 | {"linespan", no_argument, 0, 'l'}, |
208 | {"onredirect", required_argument, 0, 'f'}, | 226 | {"onredirect", required_argument, 0, 'f'}, |
209 | {"certificate", required_argument, 0, 'C'}, | 227 | {"certificate", required_argument, 0, 'C'}, |
228 | {"client-cert", required_argument, 0, 'J'}, | ||
229 | {"private-key", required_argument, 0, 'K'}, | ||
210 | {"useragent", required_argument, 0, 'A'}, | 230 | {"useragent", required_argument, 0, 'A'}, |
211 | {"header", required_argument, 0, 'k'}, | 231 | {"header", required_argument, 0, 'k'}, |
212 | {"no-body", no_argument, 0, 'N'}, | 232 | {"no-body", no_argument, 0, 'N'}, |
@@ -216,6 +236,7 @@ process_arguments (int argc, char **argv) | |||
216 | {"invert-regex", no_argument, NULL, INVERT_REGEX}, | 236 | {"invert-regex", no_argument, NULL, INVERT_REGEX}, |
217 | {"use-ipv4", no_argument, 0, '4'}, | 237 | {"use-ipv4", no_argument, 0, '4'}, |
218 | {"use-ipv6", no_argument, 0, '6'}, | 238 | {"use-ipv6", no_argument, 0, '6'}, |
239 | {"extended-perfdata", no_argument, 0, 'E'}, | ||
219 | {0, 0, 0, 0} | 240 | {0, 0, 0, 0} |
220 | }; | 241 | }; |
221 | 242 | ||
@@ -236,7 +257,7 @@ process_arguments (int argc, char **argv) | |||
236 | } | 257 | } |
237 | 258 | ||
238 | while (1) { | 259 | while (1) { |
239 | c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLS::m:M:N", longopts, &option); | 260 | c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:nlLS::m:M:N:E", longopts, &option); |
240 | if (c == -1 || c == EOF) | 261 | if (c == -1 || c == EOF) |
241 | break; | 262 | break; |
242 | 263 | ||
@@ -301,10 +322,23 @@ process_arguments (int argc, char **argv) | |||
301 | days_till_exp_warn = atoi (optarg); | 322 | days_till_exp_warn = atoi (optarg); |
302 | } | 323 | } |
303 | check_cert = TRUE; | 324 | check_cert = TRUE; |
304 | /* Fall through to -S option */ | 325 | goto enable_ssl; |
326 | #endif | ||
327 | case 'J': /* use client certificate */ | ||
328 | #ifdef HAVE_SSL | ||
329 | test_file(optarg); | ||
330 | client_cert = optarg; | ||
331 | goto enable_ssl; | ||
332 | #endif | ||
333 | case 'K': /* use client private key */ | ||
334 | #ifdef HAVE_SSL | ||
335 | test_file(optarg); | ||
336 | client_privkey = optarg; | ||
337 | goto enable_ssl; | ||
305 | #endif | 338 | #endif |
306 | case 'S': /* use SSL */ | 339 | case 'S': /* use SSL */ |
307 | #ifdef HAVE_SSL | 340 | #ifdef HAVE_SSL |
341 | enable_ssl: | ||
308 | use_ssl = TRUE; | 342 | use_ssl = TRUE; |
309 | if (optarg == NULL || c != 'S') | 343 | if (optarg == NULL || c != 'S') |
310 | ssl_version = 0; | 344 | ssl_version = 0; |
@@ -316,6 +350,7 @@ process_arguments (int argc, char **argv) | |||
316 | if (specify_port == FALSE) | 350 | if (specify_port == FALSE) |
317 | server_port = HTTPS_PORT; | 351 | server_port = HTTPS_PORT; |
318 | #else | 352 | #else |
353 | /* -C -J and -K fall through to here without SSL */ | ||
319 | usage4 (_("Invalid option - SSL is not available")); | 354 | usage4 (_("Invalid option - SSL is not available")); |
320 | #endif | 355 | #endif |
321 | break; | 356 | break; |
@@ -385,6 +420,10 @@ process_arguments (int argc, char **argv) | |||
385 | free(http_method); | 420 | free(http_method); |
386 | http_method = strdup (optarg); | 421 | http_method = strdup (optarg); |
387 | break; | 422 | break; |
423 | case 'd': /* string or substring */ | ||
424 | strncpy (header_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
425 | header_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
426 | break; | ||
388 | case 's': /* string or substring */ | 427 | case 's': /* string or substring */ |
389 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | 428 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); |
390 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | 429 | string_expect[MAX_INPUT_BUFFER - 1] = 0; |
@@ -471,6 +510,9 @@ process_arguments (int argc, char **argv) | |||
471 | } | 510 | } |
472 | } | 511 | } |
473 | break; | 512 | break; |
513 | case 'E': /* show extended perfdata */ | ||
514 | show_extended_perfdata = TRUE; | ||
515 | break; | ||
474 | } | 516 | } |
475 | } | 517 | } |
476 | 518 | ||
@@ -497,6 +539,9 @@ process_arguments (int argc, char **argv) | |||
497 | if (http_method == NULL) | 539 | if (http_method == NULL) |
498 | http_method = strdup ("GET"); | 540 | http_method = strdup ("GET"); |
499 | 541 | ||
542 | if (client_cert && !client_privkey) | ||
543 | usage4 (_("If you use a client certificate you must also specify a private key file")); | ||
544 | |||
500 | return TRUE; | 545 | return TRUE; |
501 | } | 546 | } |
502 | 547 | ||
@@ -812,17 +857,33 @@ check_http (void) | |||
812 | char *pos; | 857 | char *pos; |
813 | long microsec; | 858 | long microsec; |
814 | double elapsed_time; | 859 | double elapsed_time; |
860 | long microsec_connect; | ||
861 | double elapsed_time_connect; | ||
862 | long microsec_ssl; | ||
863 | double elapsed_time_ssl; | ||
864 | long microsec_firstbyte; | ||
865 | double elapsed_time_firstbyte; | ||
866 | long microsec_headers; | ||
867 | double elapsed_time_headers; | ||
868 | long microsec_transfer; | ||
869 | double elapsed_time_transfer; | ||
815 | int page_len = 0; | 870 | int page_len = 0; |
816 | int result = STATE_OK; | 871 | int result = STATE_OK; |
817 | 872 | ||
818 | /* try to connect to the host at the given port number */ | 873 | /* try to connect to the host at the given port number */ |
874 | gettimeofday (&tv_temp, NULL); | ||
819 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | 875 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) |
820 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | 876 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); |
877 | microsec_connect = deltime (tv_temp); | ||
821 | #ifdef HAVE_SSL | 878 | #ifdef HAVE_SSL |
879 | elapsed_time_connect = (double)microsec_connect / 1.0e6; | ||
822 | if (use_ssl == TRUE) { | 880 | if (use_ssl == TRUE) { |
823 | result = np_net_ssl_init_with_hostname_and_version(sd, (use_sni ? host_name : NULL), ssl_version); | 881 | gettimeofday (&tv_temp, NULL); |
882 | result = np_net_ssl_init_with_hostname_version_and_cert(sd, (use_sni ? host_name : NULL), ssl_version, client_cert, client_privkey); | ||
824 | if (result != STATE_OK) | 883 | if (result != STATE_OK) |
825 | return result; | 884 | return result; |
885 | microsec_ssl = deltime (tv_temp); | ||
886 | elapsed_time_ssl = (double)microsec_ssl / 1.0e6; | ||
826 | if (check_cert == TRUE) { | 887 | if (check_cert == TRUE) { |
827 | result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); | 888 | result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); |
828 | np_net_ssl_cleanup(); | 889 | np_net_ssl_cleanup(); |
@@ -854,8 +915,7 @@ check_http (void) | |||
854 | /* optionally send any other header tag */ | 915 | /* optionally send any other header tag */ |
855 | if (http_opt_headers_count) { | 916 | if (http_opt_headers_count) { |
856 | for (i = 0; i < http_opt_headers_count ; i++) { | 917 | for (i = 0; i < http_opt_headers_count ; i++) { |
857 | for ((pos = strtok(http_opt_headers[i], INPUT_DELIMITER)); pos; (pos = strtok(NULL, INPUT_DELIMITER))) | 918 | xasprintf (&buf, "%s%s\r\n", buf, http_opt_headers[i]); |
858 | xasprintf (&buf, "%s%s\r\n", buf, pos); | ||
859 | } | 919 | } |
860 | /* This cannot be free'd here because a redirection will then try to access this and segfault */ | 920 | /* This cannot be free'd here because a redirection will then try to access this and segfault */ |
861 | /* Covered in a testcase in tests/check_http.t */ | 921 | /* Covered in a testcase in tests/check_http.t */ |
@@ -891,11 +951,19 @@ check_http (void) | |||
891 | } | 951 | } |
892 | 952 | ||
893 | if (verbose) printf ("%s\n", buf); | 953 | if (verbose) printf ("%s\n", buf); |
954 | gettimeofday (&tv_temp, NULL); | ||
894 | my_send (buf, strlen (buf)); | 955 | my_send (buf, strlen (buf)); |
956 | microsec_headers = deltime (tv_temp); | ||
957 | elapsed_time_headers = (double)microsec_headers / 1.0e6; | ||
895 | 958 | ||
896 | /* fetch the page */ | 959 | /* fetch the page */ |
897 | full_page = strdup(""); | 960 | full_page = strdup(""); |
961 | gettimeofday (&tv_temp, NULL); | ||
898 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | 962 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { |
963 | if ((i >= 1) && (elapsed_time_firstbyte <= 0.000001)) { | ||
964 | microsec_firstbyte = deltime (tv_temp); | ||
965 | elapsed_time_firstbyte = (double)microsec_firstbyte / 1.0e6; | ||
966 | } | ||
899 | buffer[i] = '\0'; | 967 | buffer[i] = '\0'; |
900 | xasprintf (&full_page_new, "%s%s", full_page, buffer); | 968 | xasprintf (&full_page_new, "%s%s", full_page, buffer); |
901 | free (full_page); | 969 | free (full_page); |
@@ -907,6 +975,8 @@ check_http (void) | |||
907 | break; | 975 | break; |
908 | } | 976 | } |
909 | } | 977 | } |
978 | microsec_transfer = deltime (tv_temp); | ||
979 | elapsed_time_transfer = (double)microsec_transfer / 1.0e6; | ||
910 | 980 | ||
911 | if (i < 0 && errno != ECONNRESET) { | 981 | if (i < 0 && errno != ECONNRESET) { |
912 | #ifdef HAVE_SSL | 982 | #ifdef HAVE_SSL |
@@ -1050,6 +1120,17 @@ check_http (void) | |||
1050 | } | 1120 | } |
1051 | 1121 | ||
1052 | /* Page and Header content checks go here */ | 1122 | /* Page and Header content checks go here */ |
1123 | if (strlen (header_expect)) { | ||
1124 | if (!strstr (header, header_expect)) { | ||
1125 | strncpy(&output_header_search[0],header_expect,sizeof(output_header_search)); | ||
1126 | if(output_header_search[sizeof(output_header_search)-1]!='\0') { | ||
1127 | bcopy("...",&output_header_search[sizeof(output_header_search)-4],4); | ||
1128 | } | ||
1129 | xasprintf (&msg, _("%sheader '%s' not found on '%s://%s:%d%s', "), msg, output_header_search, use_ssl ? "https" : "http", host_name ? host_name : server_address, server_port, server_url); | ||
1130 | result = STATE_CRITICAL; | ||
1131 | } | ||
1132 | } | ||
1133 | |||
1053 | 1134 | ||
1054 | if (strlen (string_expect)) { | 1135 | if (strlen (string_expect)) { |
1055 | if (!strstr (page, string_expect)) { | 1136 | if (!strstr (page, string_expect)) { |
@@ -1108,11 +1189,25 @@ check_http (void) | |||
1108 | msg[strlen(msg)-3] = '\0'; | 1189 | msg[strlen(msg)-3] = '\0'; |
1109 | 1190 | ||
1110 | /* check elapsed time */ | 1191 | /* check elapsed time */ |
1111 | xasprintf (&msg, | 1192 | if (show_extended_perfdata) |
1112 | _("%s - %d bytes in %.3f second response time %s|%s %s"), | 1193 | xasprintf (&msg, |
1113 | msg, page_len, elapsed_time, | 1194 | _("%s - %d bytes in %.3f second response time %s|%s %s %s %s %s %s %s"), |
1114 | (display_html ? "</A>" : ""), | 1195 | msg, page_len, elapsed_time, |
1115 | perfd_time (elapsed_time), perfd_size (page_len)); | 1196 | (display_html ? "</A>" : ""), |
1197 | perfd_time (elapsed_time), | ||
1198 | perfd_size (page_len), | ||
1199 | perfd_time_connect (elapsed_time_connect), | ||
1200 | use_ssl == TRUE ? perfd_time_ssl (elapsed_time_ssl) : "", | ||
1201 | perfd_time_headers (elapsed_time_headers), | ||
1202 | perfd_time_firstbyte (elapsed_time_firstbyte), | ||
1203 | perfd_time_transfer (elapsed_time_transfer)); | ||
1204 | else | ||
1205 | xasprintf (&msg, | ||
1206 | _("%s - %d bytes in %.3f second response time %s|%s %s"), | ||
1207 | msg, page_len, elapsed_time, | ||
1208 | (display_html ? "</A>" : ""), | ||
1209 | perfd_time (elapsed_time), | ||
1210 | perfd_size (page_len)); | ||
1116 | 1211 | ||
1117 | result = max_state_alt(get_status(elapsed_time, thlds), result); | 1212 | result = max_state_alt(get_status(elapsed_time, thlds), result); |
1118 | 1213 | ||
@@ -1301,7 +1396,30 @@ char *perfd_time (double elapsed_time) | |||
1301 | TRUE, 0, FALSE, 0); | 1396 | TRUE, 0, FALSE, 0); |
1302 | } | 1397 | } |
1303 | 1398 | ||
1399 | char *perfd_time_connect (double elapsed_time_connect) | ||
1400 | { | ||
1401 | return fperfdata ("time_connect", elapsed_time_connect, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
1402 | } | ||
1403 | |||
1404 | char *perfd_time_ssl (double elapsed_time_ssl) | ||
1405 | { | ||
1406 | return fperfdata ("time_ssl", elapsed_time_ssl, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
1407 | } | ||
1408 | |||
1409 | char *perfd_time_headers (double elapsed_time_headers) | ||
1410 | { | ||
1411 | return fperfdata ("time_headers", elapsed_time_headers, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
1412 | } | ||
1413 | |||
1414 | char *perfd_time_firstbyte (double elapsed_time_firstbyte) | ||
1415 | { | ||
1416 | return fperfdata ("time_firstbyte", elapsed_time_firstbyte, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
1417 | } | ||
1304 | 1418 | ||
1419 | char *perfd_time_transfer (double elapsed_time_transfer) | ||
1420 | { | ||
1421 | return fperfdata ("time_transfer", elapsed_time_transfer, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
1422 | } | ||
1305 | 1423 | ||
1306 | char *perfd_size (int page_len) | 1424 | char *perfd_size (int page_len) |
1307 | { | 1425 | { |
@@ -1354,7 +1472,13 @@ print_help (void) | |||
1354 | printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); | 1472 | printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); |
1355 | printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]"); | 1473 | printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]"); |
1356 | printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443")); | 1474 | printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443")); |
1357 | printf (" %s\n", _("(when this option is used the URL is not checked.)\n")); | 1475 | printf (" %s\n", _("(when this option is used the URL is not checked.)")); |
1476 | printf (" %s\n", "-J, --client-cert=FILE"); | ||
1477 | printf (" %s\n", _("Name of file that contains the client certificate (PEM format)")); | ||
1478 | printf (" %s\n", _("to be used in establishing the SSL session")); | ||
1479 | printf (" %s\n", "-K, --private-key=FILE"); | ||
1480 | printf (" %s\n", _("Name of file containing the private key (PEM format)")); | ||
1481 | printf (" %s\n", _("matching the client certificate")); | ||
1358 | #endif | 1482 | #endif |
1359 | 1483 | ||
1360 | printf (" %s\n", "-e, --expect=STRING"); | 1484 | printf (" %s\n", "-e, --expect=STRING"); |
@@ -1362,6 +1486,8 @@ print_help (void) | |||
1362 | printf (" %s", _("the first (status) line of the server response (default: ")); | 1486 | printf (" %s", _("the first (status) line of the server response (default: ")); |
1363 | printf ("%s)\n", HTTP_EXPECT); | 1487 | printf ("%s)\n", HTTP_EXPECT); |
1364 | printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | 1488 | printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); |
1489 | printf (" %s\n", "-d, --header-string=STRING"); | ||
1490 | printf (" %s\n", _("String to expect in the response headers")); | ||
1365 | printf (" %s\n", "-s, --string=STRING"); | 1491 | printf (" %s\n", "-s, --string=STRING"); |
1366 | printf (" %s\n", _("String to expect in the content")); | 1492 | printf (" %s\n", _("String to expect in the content")); |
1367 | printf (" %s\n", "-u, --url=PATH"); | 1493 | printf (" %s\n", "-u, --url=PATH"); |
@@ -1396,6 +1522,8 @@ print_help (void) | |||
1396 | printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); | 1522 | printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); |
1397 | printf (" %s\n", "-k, --header=STRING"); | 1523 | printf (" %s\n", "-k, --header=STRING"); |
1398 | printf (" %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers")); | 1524 | printf (" %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers")); |
1525 | printf (" %s\n", "-E, --extended-perfdata"); | ||
1526 | printf (" %s\n", _("Print additional performance data")); | ||
1399 | printf (" %s\n", "-L, --link"); | 1527 | printf (" %s\n", "-L, --link"); |
1400 | printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); | 1528 | printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); |
1401 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>"); | 1529 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>"); |
@@ -1461,9 +1589,10 @@ print_usage (void) | |||
1461 | { | 1589 | { |
1462 | printf ("%s\n", _("Usage:")); | 1590 | printf ("%s\n", _("Usage:")); |
1463 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | 1591 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); |
1464 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-a auth]\n"); | 1592 | printf (" [-J <client certificate file>] [-K <private key>]\n"); |
1593 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); | ||
1465 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | 1594 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); |
1466 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | 1595 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); |
1467 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | 1596 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); |
1468 | printf (" [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]\n"); | 1597 | printf (" [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]\n"); |
1469 | printf (" [-T <content-type>] [-j method]\n"); | 1598 | printf (" [-T <content-type>] [-j method]\n"); |