summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-04-15 13:28:50 (GMT)
committerSven Nierlein <sven@nierlein.de>2018-10-22 14:30:31 (GMT)
commitf4a49a8b34ab3826d4e11ebc31e3709c0536176f (patch)
treeb69be70c3b01dee0155f5a26aac6b8443078cc62
parentd5d71dde61eb2e251c1f9555eef97cb0bcdf55cd (diff)
downloadmonitoring-plugins-f4a49a8b34ab3826d4e11ebc31e3709c0536176f.tar.gz
added -L option
-rw-r--r--plugins/check_curl.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 08327e6..dac4132 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -136,6 +136,7 @@ char string_expect[MAX_INPUT_BUFFER] = "";
136char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; 136char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT;
137int server_expect_yn = 0; 137int server_expect_yn = 0;
138char user_auth[MAX_INPUT_BUFFER] = ""; 138char user_auth[MAX_INPUT_BUFFER] = "";
139int display_html = FALSE;
139int onredirect = STATE_OK; 140int onredirect = STATE_OK;
140int use_ssl = FALSE; 141int use_ssl = FALSE;
141int use_sni = TRUE; 142int use_sni = TRUE;
@@ -188,6 +189,11 @@ main (int argc, char **argv)
188 if (process_arguments (argc, argv) == ERROR) 189 if (process_arguments (argc, argv) == ERROR)
189 usage4 (_("Could not parse arguments")); 190 usage4 (_("Could not parse arguments"));
190 191
192 if (display_html == TRUE)
193 printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
194 use_ssl ? "https" : "http", host_name ? host_name : server_address,
195 server_port, server_url);
196
191 result = check_http (); 197 result = check_http ();
192 return result; 198 return result;
193} 199}
@@ -627,6 +633,7 @@ process_arguments (int argc, char **argv)
627 int option = 0; 633 int option = 0;
628 static struct option longopts[] = { 634 static struct option longopts[] = {
629 STD_LONG_OPTS, 635 STD_LONG_OPTS,
636 {"link", no_argument, 0, 'L'},
630 {"ssl", optional_argument, 0, 'S'}, 637 {"ssl", optional_argument, 0, 'S'},
631 {"sni", no_argument, 0, SNI_OPTION}, 638 {"sni", no_argument, 0, SNI_OPTION},
632 {"post", required_argument, 0, 'P'}, 639 {"post", required_argument, 0, 'P'},
@@ -678,7 +685,7 @@ process_arguments (int argc, char **argv)
678 } 685 }
679 686
680 while (1) { 687 while (1) {
681 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:S::m:M:NE", longopts, &option); 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);
682 if (c == -1 || c == EOF || c == 1) 689 if (c == -1 || c == EOF || c == 1)
683 break; 690 break;
684 691
@@ -762,6 +769,9 @@ process_arguments (int argc, char **argv)
762 case 'k': /* Additional headers */ 769 case 'k': /* Additional headers */
763 header_list = curl_slist_append(header_list, optarg); 770 header_list = curl_slist_append(header_list, optarg);
764 break; 771 break;
772 case 'L': /* show html link */
773 display_html = TRUE;
774 break;
765 case 'C': /* Check SSL cert validity */ 775 case 'C': /* Check SSL cert validity */
766#ifdef LIBCURL_FEATURE_SSL 776#ifdef LIBCURL_FEATURE_SSL
767 if ((temp=strchr(optarg,','))!=NULL) { 777 if ((temp=strchr(optarg,','))!=NULL) {
@@ -1144,6 +1154,8 @@ print_help (void)
1144 printf (" %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers")); 1154 printf (" %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers"));
1145 printf (" %s\n", "-E, --extended-perfdata"); 1155 printf (" %s\n", "-E, --extended-perfdata");
1146 printf (" %s\n", _("Print additional performance data")); 1156 printf (" %s\n", _("Print additional performance data"));
1157 printf (" %s\n", "-L, --link");
1158 printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
1147 printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>"); 1159 printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>");
1148 printf (" %s\n", _("How to handle redirected pages.")); 1160 printf (" %s\n", _("How to handle redirected pages."));
1149 printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); 1161 printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
@@ -1214,7 +1226,7 @@ print_usage (void)
1214 printf ("%s\n", _("Usage:")); 1226 printf ("%s\n", _("Usage:"));
1215 printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); 1227 printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
1216 printf (" [-J <client certificate file>] [-K <private key>] [--ca-cert <CA certificate file>]\n"); 1228 printf (" [-J <client certificate file>] [-K <private key>] [--ca-cert <CA certificate file>]\n");
1217 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-E] [-a auth]\n"); 1229 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n");
1218 printf (" [-f <ok|warning|critcal|follow>]\n"); 1230 printf (" [-f <ok|warning|critcal|follow>]\n");
1219 printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); 1231 printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
1220 printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); 1232 printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");