summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-04-15 18:27:50 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-04-15 18:27:50 +0200
commita66c7883070a06d4274a9193b3db43459a4345d6 (patch)
tree180b83dacb365a649e41aa9f2c26faf5a97a2161
parentb9cab611789b1e04a5180a24a92847226ae6cfdf (diff)
downloadmonitoring-plugins-a66c788.tar.gz
added -n and more display_html stuff
-rw-r--r--plugins/check_curl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index dac41325..103937c9 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -592,11 +592,13 @@ check_http (void)
592 msg[strlen(msg)-3] = '\0'; 592 msg[strlen(msg)-3] = '\0';
593 593
594 /* TODO: separate _() msg and status code: die (result, "HTTP %s: %s\n", state_text(result), msg); */ 594 /* TODO: separate _() msg and status code: die (result, "HTTP %s: %s\n", state_text(result), msg); */
595 die (result, "HTTP %s: HTTP/%d.%d %d %s%s%s - %d bytes in %.3f second response time |%s\n", 595 die (result, "HTTP %s: HTTP/%d.%d %d %s%s%s - %d bytes in %.3f second response time %s|%s\n",
596 state_text(result), status_line.http_major, status_line.http_minor, 596 state_text(result), status_line.http_major, status_line.http_minor,
597 status_line.http_code, status_line.msg, 597 status_line.http_code, status_line.msg,
598 strlen(msg) > 0 ? " - " : "", 598 strlen(msg) > 0 ? " - " : "",
599 msg, page_len, total_time, perfstring); 599 msg, page_len, total_time,
600 (display_html ? "</A>" : ""),
601 perfstring);
600 602
601 /* proper cleanup after die? */ 603 /* proper cleanup after die? */
602 curlhelp_free_statusline(&status_line); 604 curlhelp_free_statusline(&status_line);
@@ -634,6 +636,7 @@ process_arguments (int argc, char **argv)
634 static struct option longopts[] = { 636 static struct option longopts[] = {
635 STD_LONG_OPTS, 637 STD_LONG_OPTS,
636 {"link", no_argument, 0, 'L'}, 638 {"link", no_argument, 0, 'L'},
639 {"nohtml", no_argument, 0, 'n'},
637 {"ssl", optional_argument, 0, 'S'}, 640 {"ssl", optional_argument, 0, 'S'},
638 {"sni", no_argument, 0, SNI_OPTION}, 641 {"sni", no_argument, 0, SNI_OPTION},
639 {"post", required_argument, 0, 'P'}, 642 {"post", required_argument, 0, 'P'},
@@ -685,7 +688,7 @@ process_arguments (int argc, char **argv)
685 } 688 }
686 689
687 while (1) { 690 while (1) {
688 c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:p:d:e:s:R:r:u:f:C:J:K:LS::m:M:NE", longopts, &option); 691 c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:p:d:e:s:R:r:u:f:C:J:K:nLS::m:M:NE", longopts, &option);
689 if (c == -1 || c == EOF || c == 1) 692 if (c == -1 || c == EOF || c == 1)
690 break; 693 break;
691 694
@@ -772,6 +775,9 @@ process_arguments (int argc, char **argv)
772 case 'L': /* show html link */ 775 case 'L': /* show html link */
773 display_html = TRUE; 776 display_html = TRUE;
774 break; 777 break;
778 case 'n': /* do not show html link */
779 display_html = FALSE;
780 break;
775 case 'C': /* Check SSL cert validity */ 781 case 'C': /* Check SSL cert validity */
776#ifdef LIBCURL_FEATURE_SSL 782#ifdef LIBCURL_FEATURE_SSL
777 if ((temp=strchr(optarg,','))!=NULL) { 783 if ((temp=strchr(optarg,','))!=NULL) {