summaryrefslogtreecommitdiffstats
path: root/web/attachments/456910-nagios-plugins-check_http_metadata.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/456910-nagios-plugins-check_http_metadata.patch')
-rw-r--r--web/attachments/456910-nagios-plugins-check_http_metadata.patch351
1 files changed, 351 insertions, 0 deletions
diff --git a/web/attachments/456910-nagios-plugins-check_http_metadata.patch b/web/attachments/456910-nagios-plugins-check_http_metadata.patch
new file mode 100644
index 0000000..2cda3e5
--- /dev/null
+++ b/web/attachments/456910-nagios-plugins-check_http_metadata.patch
@@ -0,0 +1,351 @@
1commit 77d700600f51880583484b0e7e56b0c896e0d132
2Author: Dejan Muhamedagic <dejan@suse.de>
3Date: Fri Nov 23 11:45:14 2012 +0100
4
5 check_http: add support for metadata
6
7diff --git a/plugins/check_http.c b/plugins/check_http.c
8index 9231a55..cc9f39f 100644
9--- a/plugins/check_http.c
10+++ b/plugins/check_http.c
11@@ -135,6 +135,227 @@ char *perfd_size (int page_len);
12 void print_help (void);
13 void print_usage (void);
14
15+static struct help_head resource_meta = {
16+ "http",
17+ "Test the HTTP service",
18+ "This plugin tests the HTTP service on the specified host. It can test\n"
19+ "normal (http) and secure (https) servers, follow redirects, search for\n"
20+ "strings and regular expressions, check connection times, and report on\n"
21+ "certificate expiration times.\n"
22+};
23+
24+static struct parameter_help options_help[] = {
25+ /* hostname */
26+ {
27+ "hostname", 'H',
28+ "Host name",
29+ 0, 1, "string", "", "ADDRESS",
30+ "Host name argument for servers using host headers (virtual host)\n"
31+ "Append a port to include it in the header (eg: example.com:5000)\n"
32+ },
33+ /* IP-address */
34+ {
35+ "IP-address", 'I',
36+ "IP address or name",
37+ 0, 0, "string", "", "ADDRESS",
38+ "IP address or name (use numeric address if possible to bypass DNS lookup).\n"
39+ },
40+ /* port */
41+ {
42+ "port", 'p',
43+ "Port number (default: 80)",
44+ 0, 0, "integer", "80", "INTEGER",
45+ },
46+ /* use-ipv4 */
47+ {
48+ "use-ipv4", '4',
49+ "Use IPv4 connection",
50+ 0, 0, "boolean", "false", "",
51+ },
52+ /* use-ipv6 */
53+ {
54+ "use-ipv6", '6',
55+ "Use IPv6 connection",
56+ 0, 0, "boolean", "false", "",
57+ },
58+#ifdef HAVE_SSL
59+ /* ssl */
60+ {
61+ "ssl", 'S',
62+ "Connect via SSL.",
63+ 0, 0, "string", "", "VERSION",
64+ "Connect via SSL. Port defaults to 443. VERSION is optional, and prevents\n"
65+ "auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).\n"
66+ },
67+ /* sni */
68+ {
69+ "sni", 0,
70+ "Enable SSL/TLS hostname extension support (SNI)",
71+ 0, 0, "boolean", "false", "",
72+ },
73+ /* certificate */
74+ {
75+ "certificate", 'C',
76+ "Minimum number of days a certificate has to be valid",
77+ 0, 0, "integer", "", "INTEGER",
78+ "Minimum number of days a certificate has to be valid. Port defaults to 443\n"
79+ "(when this option is used the URL is not checked.)\n"
80+ },
81+#endif
82+ /* expect */
83+ {
84+ "expect", 'e',
85+ "list of strings of which at least one must match",
86+ 0, 0, "string", "", "STRING",
87+ "Comma-delimited list of strings, at least one of them is expected in\n"
88+ "the first (status) line of the server response (default: HTTP/1.)\n"
89+ "If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)\n"
90+ },
91+ /* string */
92+ {
93+ "string", 's',
94+ "String to expect in the content",
95+ 0, 0, "string", "", "STRING",
96+ },
97+ /* url */
98+ {
99+ "url", 'u',
100+ "URL to GET or POST (default: /)",
101+ 0, 0, "string", "/", "PATH",
102+ },
103+ /* post */
104+ {
105+ "post", 'P',
106+ "URL encoded http POST data",
107+ 0, 0, "string", "", "STRING",
108+ },
109+ /* method */
110+ {
111+ "method", 'j',
112+ "Set HTTP method.",
113+ 0, 0, "string", "", "STRING",
114+ },
115+ /* no-body */
116+ {
117+ "no-body", 'N',
118+ "Don't wait for document body",
119+ 0, 0, "boolean", "false", "",
120+ "Don't wait for document body: stop reading after headers.\n"
121+ "(Note that this still does an HTTP GET or POST, not a HEAD.)\n"
122+ },
123+ /* max-age */
124+ {
125+ "max-age", 'M',
126+ "maximum age of document",
127+ 0, 0, "string", "", "SECONDS",
128+ "Warn if document is more than SECONDS old. the number can also be of\n"
129+ "the form \"10m\" for minutes, \"10h\" for hours, or \"10d\" for days.\n"
130+ },
131+ /* content-type */
132+ {
133+ "content-type", 'T',
134+ "specify Content-Type header media type when POSTing",
135+ 0, 0, "string", "", "STRING",
136+ },
137+ /* linespan */
138+ {
139+ "linespan", 'l',
140+ "Allow regex to span newlines (must precede -r or -R)",
141+ 0, 0, "boolean", "false", "",
142+ },
143+ /* regex */
144+ {
145+ "regex", 'r',
146+ "Search page for regex STRING",
147+ 0, 0, "boolean", "false", "",
148+ },
149+ /* eregi */
150+ {
151+ "eregi", 'R',
152+ "Search page for case-insensitive regex STRING",
153+ 0, 0, "string", "", "STRING",
154+ },
155+ /* invert-regex */
156+ {
157+ "invert-regex", 0,
158+ "Return CRITICAL if found, OK if not",
159+ 0, 0, "boolean", "false", "",
160+ },
161+ /* authorization */
162+ {
163+ "authorization", 'a',
164+ "Username:password on sites with basic authentication",
165+ 0, 0, "string", "", "AUTH_PAIR",
166+ },
167+ /* proxy_authorization */
168+ {
169+ "proxy_authorization", 'b',
170+ "Username:password on proxy-servers with basic authentication",
171+ 0, 0, "string", "", "AUTH_PAIR",
172+ },
173+ /* useragent */
174+ {
175+ "useragent", 'A',
176+ "String to be sent in http header as \"User Agent\"",
177+ 0, 0, "string", "", "STRING",
178+ },
179+ /* header */
180+ {
181+ "header", 'k',
182+ "other tags to be sent in http header",
183+ 0, 0, "string", "", "STRING",
184+ "Any other tags to be sent in http header. Use multiple times for additional headers\n"
185+ },
186+ /* link */
187+ {
188+ "link", 'L',
189+ "Wrap output in HTML link (obsoleted by urlize)",
190+ 0, 0, "boolean", "false", "",
191+ },
192+ /* onredirect */
193+ {
194+ "onredirect", 'f',
195+ "How to handle redirected pages",
196+ 0, 0, "string", "", "<ok|warning|critical|follow|sticky|stickyport>",
197+ "How to handle redirected pages. sticky is like follow but stick to the\n"
198+ "specified IP address. stickyport also ensures port stays the same.\n"
199+ },
200+ /* pagesize */
201+ {
202+ "pagesize", 'm',
203+ "minimum[:maximum] page size",
204+ 0, 0, "string", "", "INTEGER<:INTEGER>",
205+ "Minimum page size required (bytes) : Maximum page size required (bytes)\n"
206+ },
207+ /* warning */
208+ {
209+ "warning", 'w',
210+ "Response time to result in warning status (seconds)",
211+ 0, 0, "string", "", "DOUBLE",
212+ },
213+ /* critical */
214+ {
215+ "critical", 'c',
216+ "Response time to result in critical status (seconds)",
217+ 0, 0, "string", "", "DOUBLE",
218+ },
219+ /* timeout */
220+ {
221+ "timeout", 't',
222+ "Seconds before connection times out (default: 10)",
223+ 0, 0, "integer", "10", "INTEGER",
224+ },
225+ /* extra-opts */
226+ {
227+ "extra-opts", 0,
228+ "ini file with extra options",
229+ 0, 0, "string", "", "string",
230+ "Read options from an ini file. See http://nagiosplugins.org/extra-opts\n"
231+ "for usage and examples.\n"
232+ },
233+ {}
234+};
235+
236 int
237 main (int argc, char **argv)
238 {
239@@ -151,6 +372,12 @@ main (int argc, char **argv)
240 NP_VERSION, VERSION);
241
242 /* Parse extra opts if any */
243+ if (argc==2 && !strcmp(argv[1], "--metadata")) {
244+ /* dump metadata and exit */
245+ print_meta_data(&resource_meta, options_help);
246+ exit(0);
247+ }
248+
249 argv=np_extra_opts (&argc, argv, progname);
250
251 if (process_arguments (argc, argv) == ERROR)
252@@ -1319,10 +1546,7 @@ print_help (void)
253 printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
254 printf (COPYRIGHT, copyright, email);
255
256- printf ("%s\n", _("This plugin tests the HTTP service on the specified host. It can test"));
257- printf ("%s\n", _("normal (http) and secure (https) servers, follow redirects, search for"));
258- printf ("%s\n", _("strings and regular expressions, check connection times, and report on"));
259- printf ("%s\n", _("certificate expiration times."));
260+ print_help_head(&resource_meta);
261
262 printf ("\n\n");
263
264@@ -1333,80 +1557,7 @@ print_help (void)
265 printf ("\n");
266
267 printf (UT_HELP_VRSN);
268- printf (UT_EXTRA_OPTS);
269-
270- printf (" %s\n", "-H, --hostname=ADDRESS");
271- printf (" %s\n", _("Host name argument for servers using host headers (virtual host)"));
272- printf (" %s\n", _("Append a port to include it in the header (eg: example.com:5000)"));
273- printf (" %s\n", "-I, --IP-address=ADDRESS");
274- printf (" %s\n", _("IP address or name (use numeric address if possible to bypass DNS lookup)."));
275- printf (" %s\n", "-p, --port=INTEGER");
276- printf (" %s", _("Port number (default: "));
277- printf ("%d)\n", HTTP_PORT);
278-
279- printf (UT_IPv46);
280-
281-#ifdef HAVE_SSL
282- printf (" %s\n", "-S, --ssl=VERSION");
283- printf (" %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents"));
284- printf (" %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3)."));
285- printf (" %s\n", "--sni");
286- printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)"));
287- printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]");
288- printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443"));
289- printf (" %s\n", _("(when this option is used the URL is not checked.)\n"));
290-#endif
291-
292- printf (" %s\n", "-e, --expect=STRING");
293- printf (" %s\n", _("Comma-delimited list of strings, at least one of them is expected in"));
294- printf (" %s", _("the first (status) line of the server response (default: "));
295- printf ("%s)\n", HTTP_EXPECT);
296- printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)"));
297- printf (" %s\n", "-s, --string=STRING");
298- printf (" %s\n", _("String to expect in the content"));
299- printf (" %s\n", "-u, --url=PATH");
300- printf (" %s\n", _("URL to GET or POST (default: /)"));
301- printf (" %s\n", "-P, --post=STRING");
302- printf (" %s\n", _("URL encoded http POST data"));
303- printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)");
304- printf (" %s\n", _("Set HTTP method."));
305- printf (" %s\n", "-N, --no-body");
306- printf (" %s\n", _("Don't wait for document body: stop reading after headers."));
307- printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)"));
308- printf (" %s\n", "-M, --max-age=SECONDS");
309- printf (" %s\n", _("Warn if document is more than SECONDS old. the number can also be of"));
310- printf (" %s\n", _("the form \"10m\" for minutes, \"10h\" for hours, or \"10d\" for days."));
311- printf (" %s\n", "-T, --content-type=STRING");
312- printf (" %s\n", _("specify Content-Type header media type when POSTing\n"));
313-
314- printf (" %s\n", "-l, --linespan");
315- printf (" %s\n", _("Allow regex to span newlines (must precede -r or -R)"));
316- printf (" %s\n", "-r, --regex, --ereg=STRING");
317- printf (" %s\n", _("Search page for regex STRING"));
318- printf (" %s\n", "-R, --eregi=STRING");
319- printf (" %s\n", _("Search page for case-insensitive regex STRING"));
320- printf (" %s\n", "--invert-regex");
321- printf (" %s\n", _("Return CRITICAL if found, OK if not\n"));
322-
323- printf (" %s\n", "-a, --authorization=AUTH_PAIR");
324- printf (" %s\n", _("Username:password on sites with basic authentication"));
325- printf (" %s\n", "-b, --proxy-authorization=AUTH_PAIR");
326- printf (" %s\n", _("Username:password on proxy-servers with basic authentication"));
327- printf (" %s\n", "-A, --useragent=STRING");
328- printf (" %s\n", _("String to be sent in http header as \"User Agent\""));
329- printf (" %s\n", "-k, --header=STRING");
330- printf (" %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers"));
331- printf (" %s\n", "-L, --link");
332- printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
333- printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>");
334- printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
335- printf (" %s\n", _("specified IP address. stickyport also ensures port stays the same."));
336- printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
337- printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));
338-
339- printf (UT_WARN_CRIT);
340-
341- printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
342+ print_parameters_help(options_help);
343
344 printf (UT_VERBOSE);
345
346@@ -1467,4 +1618,5 @@ print_usage (void)
347 printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
348 printf (" [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]\n");
349 printf (" [-T <content-type>] [-j method]\n");
350+ printf (" %s --metadata\n", progname);
351 }