From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/432136-check_http.patch | 77 +++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 web/attachments/432136-check_http.patch (limited to 'web/attachments/432136-check_http.patch') diff --git a/web/attachments/432136-check_http.patch b/web/attachments/432136-check_http.patch new file mode 100644 index 0000000..827bfba --- /dev/null +++ b/web/attachments/432136-check_http.patch @@ -0,0 +1,77 @@ +--- check_http.c.old 2010-07-27 12:47:16.000000000 -0700 ++++ check_http.c 2012-01-03 16:43:56.000000000 -0800 +@@ -99,7 +99,9 @@ + int server_url_length; + int server_expect_yn = 0; + char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; ++char header_expect[MAX_INPUT_BUFFER] = ""; + char string_expect[MAX_INPUT_BUFFER] = ""; ++char output_header_search[30] = ""; + char output_string_search[30] = ""; + double warning_time = 0; + int check_warning_time = FALSE; +@@ -198,6 +200,7 @@ + {"port", required_argument, 0, 'p'}, + {"authorization", required_argument, 0, 'a'}, + {"proxy_authorization", required_argument, 0, 'b'}, ++ {"return_header", required_argument, 0, 'd'}, + {"string", required_argument, 0, 's'}, + {"expect", required_argument, 0, 'e'}, + {"regex", required_argument, 0, 'r'}, +@@ -235,7 +238,7 @@ + } + + while (1) { +- 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:nlLSm:M:N", longopts, &option); ++ 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:nlLSm:M:N", longopts, &option); + if (c == -1 || c == EOF) + break; + +@@ -374,6 +377,10 @@ + free(http_method); + http_method = strdup (optarg); + break; ++ case 'd': /* string or substring */ ++ strncpy (header_expect, optarg, MAX_INPUT_BUFFER - 1); ++ header_expect[MAX_INPUT_BUFFER - 1] = 0; ++ break; + case 's': /* string or substring */ + strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); + string_expect[MAX_INPUT_BUFFER - 1] = 0; +@@ -1036,6 +1043,18 @@ + + /* Page and Header content checks go here */ + ++ if (strlen (header_expect)) { ++ if (!strstr (header, header_expect)) { ++ strncpy(&output_header_search[0],header_expect,sizeof(output_header_search)); ++ if(output_header_search[sizeof(output_header_search)-1]!='\0') { ++ bcopy("...",&output_header_search[sizeof(output_header_search)-4],4); ++ } ++ asprintf (&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); ++ result = STATE_CRITICAL; ++ } ++ } ++ ++ + if (strlen (string_expect)) { + if (!strstr (page, string_expect)) { + strncpy(&output_string_search[0],string_expect,sizeof(output_string_search)); +@@ -1368,6 +1387,8 @@ + + printf (" %s\n", "-l, --linespan"); + printf (" %s\n", _("Allow regex to span newlines (must precede -r or -R)")); ++ printf (" %s\n", "-d, --header-string=STRING"); ++ printf (" %s\n", _("Search header for regex STRING")); + printf (" %s\n", "-r, --regex, --ereg=STRING"); + printf (" %s\n", _("Search page for regex STRING")); + printf (" %s\n", "-R, --eregi=STRING"); +@@ -1438,7 +1459,7 @@ + printf ("%s\n", _("Usage:")); + printf (" %s -H | -I [-u ] [-p ]\n",progname); + printf (" [-w ] [-c ] [-t ] [-L] [-a auth]\n"); +- printf (" [-b proxy_auth] [-f ]\n"); ++ printf (" [-b proxy_auth] [-d string] [-f ]\n"); + printf (" [-e ] [-s string] [-l] [-r | -R ]\n"); + printf (" [-P string] [-m :] [-4|-6] [-N] [-M ]\n"); + printf (" [-A string] [-k string] [-S] [--sni] [-C ] [-T ]\n"); -- cgit v1.2.3-74-g34f1