summaryrefslogtreecommitdiffstats
path: root/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch')
-rw-r--r--web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch b/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch
new file mode 100644
index 0000000..1a27819
--- /dev/null
+++ b/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch
@@ -0,0 +1,61 @@
1diff --git a/plugins/check_http.c b/plugins/check_http.c
2index 7f773c8..d363c17 100644
3--- a/plugins/check_http.c
4+++ b/plugins/check_http.c
5@@ -100,6 +100,7 @@ int server_url_length;
6 int server_expect_yn = 0;
7 char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT;
8 char string_expect[MAX_INPUT_BUFFER] = "";
9+int output_string_match = FALSE;
10 double warning_time = 0;
11 int check_warning_time = FALSE;
12 double critical_time = 0;
13@@ -198,6 +199,7 @@ process_arguments (int argc, char **argv)
14 {"authorization", required_argument, 0, 'a'},
15 {"proxy_authorization", required_argument, 0, 'b'},
16 {"string", required_argument, 0, 's'},
17+ {"output-string-match", no_argument, 0, 'o'},
18 {"expect", required_argument, 0, 'e'},
19 {"regex", required_argument, 0, 'r'},
20 {"ereg", required_argument, 0, 'r'},
21@@ -234,7 +236,7 @@ process_arguments (int argc, char **argv)
22 }
23
24 while (1) {
25- 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);
26+ c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:oR:r:u:f:C:nlLSm:M:N", longopts, &option);
27 if (c == -1 || c == EOF)
28 break;
29
30@@ -377,6 +379,9 @@ process_arguments (int argc, char **argv)
31 strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1);
32 string_expect[MAX_INPUT_BUFFER - 1] = 0;
33 break;
34+ case 'o': /* output 'string' in STDOUT 'string not found' msg */
35+ output_string_match = TRUE;
36+ break;
37 case 'e': /* string or substring */
38 strncpy (server_expect, optarg, MAX_INPUT_BUFFER - 1);
39 server_expect[MAX_INPUT_BUFFER - 1] = 0;
40@@ -1037,7 +1042,11 @@ check_http (void)
41
42 if (strlen (string_expect)) {
43 if (!strstr (page, string_expect)) {
44- asprintf (&msg, _("%sstring not found, "), msg);
45+ if(!output_string_match){
46+ asprintf (&msg, _("%sstring not found, "), msg);
47+ } else {
48+ asprintf (&msg, _("%sstring '%s' not found, "), msg, string_expect);
49+ }
50 result = STATE_CRITICAL;
51 }
52 }
53@@ -1346,6 +1355,8 @@ print_help (void)
54 printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)"));
55 printf (" %s\n", "-s, --string=STRING");
56 printf (" %s\n", _("String to expect in the content"));
57+ printf (" %s\n", "-o, --output-string-match");
58+ printf (" %s\n", _("Show given string as 'string xxx not found' message"));
59 printf (" %s\n", "-u, --url=PATH");
60 printf (" %s\n", _("URL to GET or POST (default: /)"));
61 printf (" %s\n", "-P, --post=STRING");