diff options
-rw-r--r-- | plugins/check_curl.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 8ed1aee..45a52f0 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -32,8 +32,8 @@ | |||
32 | * | 32 | * |
33 | * | 33 | * |
34 | *****************************************************************************/ | 34 | *****************************************************************************/ |
35 | |||
36 | const char *progname = "check_curl"; | 35 | const char *progname = "check_curl"; |
36 | |||
37 | const char *copyright = "2006-2017"; | 37 | const char *copyright = "2006-2017"; |
38 | const char *email = "devel@monitoring-plugins.org"; | 38 | const char *email = "devel@monitoring-plugins.org"; |
39 | 39 | ||
@@ -200,9 +200,10 @@ main (int argc, char **argv) | |||
200 | 200 | ||
201 | /* backward-compatible behaviour, be tolerant in checks */ | 201 | /* backward-compatible behaviour, be tolerant in checks */ |
202 | if (!check_cert) { | 202 | if (!check_cert) { |
203 | //TODO: depending on more options have aspects we want | 203 | /* TODO: depending on more options have aspects we want |
204 | //to be tolerant about | 204 | * to be tolerant about |
205 | //curl_easy_setopt( curl, CURLOPT_SSL_VERIFYPEER, 1 ); | 205 | * curl_easy_setopt( curl, CURLOPT_SSL_VERIFYPEER, 1 ); |
206 | */ | ||
206 | curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0); | 207 | curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0); |
207 | curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0); | 208 | curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0); |
208 | } | 209 | } |
@@ -230,9 +231,9 @@ main (int argc, char **argv) | |||
230 | */ | 231 | */ |
231 | 232 | ||
232 | /* TODO: --cacert: CA certificate file to verify SSL connection against (SSL) */ | 233 | /* TODO: --cacert: CA certificate file to verify SSL connection against (SSL) */ |
233 | //~ if( args_info.cacert_given ) { | 234 | /* if( args_info.cacert_given ) { |
234 | //~ curl_easy_setopt( curl, CURLOPT_CAINFO, args_info.cacert_arg ); | 235 | curl_easy_setopt( curl, CURLOPT_CAINFO, args_info.cacert_arg ); |
235 | //~ } | 236 | } */ |
236 | 237 | ||
237 | /* handle redirections */ | 238 | /* handle redirections */ |
238 | if (onredirect == STATE_DEPENDENT) { | 239 | if (onredirect == STATE_DEPENDENT) { |
@@ -266,8 +267,8 @@ main (int argc, char **argv) | |||
266 | snprintf (perfstring, DEFAULT_BUFFER_SIZE, "time=%.6gs;%.6g;%.6g;%.6g size=%dB;;;0", | 267 | snprintf (perfstring, DEFAULT_BUFFER_SIZE, "time=%.6gs;%.6g;%.6g;%.6g size=%dB;;;0", |
267 | total_time, | 268 | total_time, |
268 | 0.0, 0.0, | 269 | 0.0, 0.0, |
269 | //~ args_info.warning_given ? args_info.warning_arg : 0.0, | 270 | ( warning_thresholds != NULL ) ? (double)thlds->warning->end : 0.0, |
270 | //~ args_info.critical_given ? args_info.critical_arg : 0.0, | 271 | critical_thresholds != NULL ? (double)thlds->critical->end : 0.0, |
271 | 0.0, | 272 | 0.0, |
272 | (int)body_buf.buflen); | 273 | (int)body_buf.buflen); |
273 | 274 | ||
@@ -340,7 +341,7 @@ main (int argc, char **argv) | |||
340 | /* -w, -c: check warning and critical level */ | 341 | /* -w, -c: check warning and critical level */ |
341 | result = max_state_alt(get_status(total_time, thlds), result); | 342 | result = max_state_alt(get_status(total_time, thlds), result); |
342 | 343 | ||
343 | //~ die (result, "HTTP %s: %s\n", state_text(result), msg); | 344 | /* TODO: separate _() msg and status code: die (result, "HTTP %s: %s\n", state_text(result), msg); */ |
344 | die (result, "HTTP %s HTTP/%d.%d %d %s - %s - %.3g seconds response time|%s\n", | 345 | die (result, "HTTP %s HTTP/%d.%d %d %s - %s - %.3g seconds response time|%s\n", |
345 | state_text(result), status_line.http_major, status_line.http_minor, | 346 | state_text(result), status_line.http_major, status_line.http_minor, |
346 | status_line.http_code, status_line.msg, msg, | 347 | status_line.http_code, status_line.msg, msg, |
@@ -513,12 +514,6 @@ process_arguments (int argc, char **argv) | |||
513 | else if (!strcmp (optarg, "follow")) | 514 | else if (!strcmp (optarg, "follow")) |
514 | onredirect = STATE_DEPENDENT; | 515 | onredirect = STATE_DEPENDENT; |
515 | else usage2 (_("Invalid onredirect option"), optarg); | 516 | else usage2 (_("Invalid onredirect option"), optarg); |
516 | //~ if (!strcmp (optarg, "stickyport")) | ||
517 | //~ onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST|STICKY_PORT; | ||
518 | //~ else if (!strcmp (optarg, "sticky")) | ||
519 | //~ onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST; | ||
520 | //~ else if (!strcmp (optarg, "follow")) | ||
521 | //~ onredirect = STATE_DEPENDENT, followsticky = STICKY_NONE; | ||
522 | if (verbose >= 2) | 517 | if (verbose >= 2) |
523 | printf(_("* Following redirects set to %s\n"), state_text(onredirect)); | 518 | printf(_("* Following redirects set to %s\n"), state_text(onredirect)); |
524 | break; | 519 | break; |
@@ -637,9 +632,8 @@ print_help (void) | |||
637 | printf (" %s\n", _("Username:password on sites with basic authentication")); | 632 | printf (" %s\n", _("Username:password on sites with basic authentication")); |
638 | printf (" %s\n", "-A, --useragent=STRING"); | 633 | printf (" %s\n", "-A, --useragent=STRING"); |
639 | printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); | 634 | printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); |
640 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>"); | 635 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>"); |
641 | printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the")); | 636 | printf (" %s\n", _("How to handle redirected pages.")); |
642 | printf (" %s\n", _("specified IP address. stickyport also ensures port stays the same.")); | ||
643 | 637 | ||
644 | printf (UT_WARN_CRIT); | 638 | printf (UT_WARN_CRIT); |
645 | 639 | ||