summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec1ff29)
raw | patch | inline | side by side (parent: ec1ff29)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 16 Jan 2003 06:29:02 +0000 (06:29 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 16 Jan 2003 06:29:02 +0000 (06:29 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@248 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_http.c | patch | blob | history |
diff --git a/plugins/check_http.c b/plugins/check_http.c
index de7a2db7f7b70b70d3917874ddca0a2908df03fc..2259c6ff88ec241c0c1195f4d22d2fe713df1e2b 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
\(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
[-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
[-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
- [-s string] [-r <regex> | -R <case-insensitive regex>]\n\
+ [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
[-P string]"
#define LONGOPTIONS "\
-L, --link=URL\n\
Wrap output in HTML link (obsoleted by urlize)\n\
-f, --onredirect=<ok|warning|critical|follow>\n\
- How to handle redirected pages\n%s\
+ How to handle redirected pages\n%s%s\
-v, --verbose\n\
Show details for command-line debugging (do not use with nagios server)\n\
-h, --help\n\
#define SSLOPTIONS ""
#endif
+#ifdef HAVE_REGEX_H
+#define REGOPTIONS "\
+ -l, --linespan\n\
+ Allow regex to span newlines (must precede -r or -R)\n\
+ -r, --regex, --ereg=STRING\n\
+ Search page for regex STRING\n\
+ -R, --eregi=STRING\n\
+ Search page for case-insensitive regex STRING\n"
+#else
+#define REGOPTIONS ""
+#endif
+
#define DESCRIPTION "\
This plugin will attempt to open an HTTP connection with the host. Successul\n\
connects return STATE_OK, refusals and timeouts return STATE_CRITICAL, other\n\
{"regex", required_argument, 0, 'r'},
{"ereg", required_argument, 0, 'r'},
{"eregi", required_argument, 0, 'R'},
+ {"linespan", no_argument, 0, 'l'},
{"onredirect", required_argument, 0, 'f'},
{"certificate", required_argument, 0, 'C'},
{0, 0, 0, 0}
strcpy (argv[c], "-n");
}
-#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLS"
+#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS"
while (1) {
#ifdef HAVE_GETOPT_H
server_expect[MAX_INPUT_BUFFER - 1] = 0;
server_expect_yn = 1;
break;
- case 'R': /* regex */
-#ifdef HAVE_REGEX_H
- cflags = REG_ICASE;
-#else
+#ifndef HAVE_REGEX_H
+ case 'l': /* linespan */
+ case 'r': /* linespan */
+ case 'R': /* linespan */
usage ("check_http: call for regex which was not a compiled option\n");
-#endif
+ break;
+#else
+ case 'l': /* linespan */
+ cflags &= ~REG_NEWLINE;
+ break;
+ case 'R': /* regex */
+ cflags |= REG_ICASE;
case 'r': /* regex */
-#ifdef HAVE_REGEX_H
- cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
strncpy (regexp, optarg, MAX_RE_SIZE - 1);
regexp[MAX_RE_SIZE - 1] = 0;
errcode = regcomp (&preg, regexp, cflags);
printf ("Could Not Compile Regular Expression: %s", errbuf);
return ERROR;
}
-#else
- usage ("check_http: call for regex which was not a compiled option\n");
-#endif
break;
+#endif
case 'v': /* verbose */
verbose = TRUE;
break;
c = optind;
- if (server_address == NULL && host_name == NULL) {
- server_address = strscpy (NULL, argv[c]);
+ if (server_address == NULL && host_name == NULL) { server_address = strscpy (NULL, argv[c]);
host_name = strscpy (NULL, argv[c++]);
}
print_usage ();
printf ("NOTE: One or both of -H and -I must be specified\n");
printf ("\nOptions:\n" LONGOPTIONS "\n", HTTP_EXPECT, HTTP_PORT,
- DEFAULT_SOCKET_TIMEOUT, SSLOPTIONS);
+ DEFAULT_SOCKET_TIMEOUT, SSLOPTIONS, REGOPTIONS);
#ifdef HAVE_SSL
printf (SSLDESCRIPTION);
#endif