summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d714b38)
raw | patch | inline | side by side (parent: d714b38)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 5 Mar 2003 00:17:15 +0000 (00:17 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 5 Mar 2003 00:17:15 +0000 (00:17 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@365 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 856acdea6e8bb7d532e859346e6abf174bbfc271..cf86d469a91ff7c09c7d0eb6f27ab47dd2caa44e 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
[-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
[-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
[-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
- [-P string]"
+ [-P string] [-m min_pg_size]"
#define LONGOPTIONS "\
-H, --hostname=ADDRESS\n\
Wrap output in HTML link (obsoleted by urlize)\n\
-f, --onredirect=<ok|warning|critical|follow>\n\
How to handle redirected pages\n%s%s\
+-m, --min=INTEGER\n\
+ Minimum page size required (bytes)\n\
-v, --verbose\n\
Show details for command-line debugging (do not use with nagios server)\n\
-h, --help\n\
int use_ssl = FALSE;
int verbose = FALSE;
int sd;
+int min_page_len = 0;
char *http_method = "GET";
char *http_post_data = "";
char buffer[MAX_INPUT_BUFFER];
{"linespan", no_argument, 0, 'l'},
{"onredirect", required_argument, 0, 'f'},
{"certificate", required_argument, 0, 'C'},
+ {"min", required_argument, 0, 'm'},
{0, 0, 0, 0}
};
#endif
strcpy (argv[c], "-n");
}
-#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS"
+#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:"
while (1) {
#ifdef HAVE_GETOPT_H
case 'v': /* verbose */
verbose = TRUE;
break;
+ case 'm': /* min_page_length */
+ min_page_len = atoi (optarg);
+ break;
}
}
char *x = NULL;
char *orig_url = NULL;
double elapsed_time;
+ int page_len = 0;
#ifdef HAVE_SSL
int sslerr;
#endif
}
#endif
+ /* make sure the page is of an appropriate size */
+ page_len = strlen (page);
+ if ((min_page_len > 0) && (page_len < min_page_len)) {
+ printf ("HTTP WARNING: page size too small%s|size=%i\n",
+ (display_html ? "</A>" : ""), page_len );
+ exit (STATE_WARNING);
+ }
/* We only get here if all tests have been passed */
asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
status_line, (float)elapsed_time,