summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1fb4232)
raw | patch | inline | side by side (parent: 1fb4232)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Fri, 18 Oct 2002 03:46:10 +0000 (03:46 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Fri, 18 Oct 2002 03:46:10 +0000 (03:46 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@137 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 3fa34eb0f2ac994d3009ebd7cdadeadf32e8d0b1..44b55a77c2eb65ba7b7cc89820dcf36f2b8665f3 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
void print_usage (void);
void print_help (void);
int process_arguments (int, char **);
-int call_getopt (int, char **);
static char *base64 (char *bin, int len);
int check_http (void);
int my_recv (void);
#ifdef HAVE_GETOPT_H
int option_index = 0;
static struct option long_options[] = {
- STD_OPTS_LONG,
+ STD_LONG_OPTS,
+ {"file",required_argument,0,'F'},
{"link", no_argument, 0, 'L'},
{"nohtml", no_argument, 0, 'n'},
{"ssl", no_argument, 0, 'S'},
strcpy (argv[c], "-n");
}
- snprintf (optchars, MAX_INPUT_BUFFER, "%s%s", STD_OPTS,
- "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:nLS"
while (1) {
#ifdef HAVE_GETOPT_H
- c = getopt_long (argc, argv, optchars, long_options, &option_index);
+ c = getopt_long (argc, argv, OPTCHARS, long_options, &option_index);
#else
- c = getopt (argc, argv, optchars);
+ c = getopt (argc, argv, OPTCHARS);
#endif
if (c == -1 || c == EOF)
break;
else if (onredirect == STATE_CRITICAL)
printf ("HTTP CRITICAL");
elapsed_time = delta_time (tv);
- asprintf (&msg, ": %s - %6.2f second response time %s%s|time=%6.2f\n",
+ asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%7.3f\n",
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""), elapsed_time);
terminate (onredirect, msg);
/* check elapsed time */
elapsed_time = delta_time (tv);
- asprintf (&msg, "HTTP problem: %s - %6.2f second response time %s%s|time=%6.2f\n",
+ asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n",
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""), elapsed_time);
if (check_critical_time == TRUE && elapsed_time > critical_time)
if (strlen (string_expect)) {
if (strstr (page, string_expect)) {
- printf ("HTTP ok: %s - %6.2f second response time %s%s|time=%6.2f\n",
+ printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
status_line, elapsed_time,
timestamp, (display_html ? "</A>" : ""), elapsed_time);
exit (STATE_OK);
}
else {
- printf ("HTTP CRITICAL: string not found%s|time=%6.2f\n",
+ printf ("HTTP CRITICAL: string not found%s|time=%7.3f\n",
(display_html ? "</A>" : ""), elapsed_time);
exit (STATE_CRITICAL);
}
if (strlen (regexp)) {
errcode = regexec (&preg, page, REGS, pmatch, 0);
if (errcode == 0) {
- printf ("HTTP ok: %s - %6.2f second response time %s%s|time=%6.2f\n",
+ printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
status_line, elapsed_time,
timestamp, (display_html ? "</A>" : ""), elapsed_time);
exit (STATE_OK);
}
else {
if (errcode == REG_NOMATCH) {
- printf ("HTTP CRITICAL: pattern not found%s|time=%6.2f\n",
+ printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n",
(display_html ? "</A>" : ""), elapsed_time);
exit (STATE_CRITICAL);
}
#endif
/* We only get here if all tests have been passed */
- asprintf (&msg, "HTTP ok: %s - %6.2f second response time %s%s|time=%6.2f\n",
+ asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
status_line, (float)elapsed_time,
timestamp, (display_html ? "</A>" : ""), elapsed_time);
terminate (STATE_OK, msg);