summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9f032b1)
raw | patch | inline | side by side (parent: 9f032b1)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 11 Sep 2003 11:50:45 +0000 (11:50 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 11 Sep 2003 11:50:45 +0000 (11:50 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@718 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 c68b2087da55d81a20b19af2e807d7d8df72f865..db949329ff77ca52ec5f99b34a3e92961dfa1191 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
int server_type_check(const char *type);
int server_port_check(int ssl_flag);
char *perfd_time (long microsec);
+char *perfd_size (int page_len);
int my_recv (void);
int my_close (void);
void print_help (void);
microsec = deltime (tv);
elapsed_time = (double)microsec / 1.0e6;
die (onredirect,
- _(" - %s - %.3f second response time %s%s|%s size=%dB\n"),
+ _(" - %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (pagesize));
} /* end if (strstr (status_line, "30[0-4]") */
microsec = deltime (tv);
elapsed_time = (double)microsec / 1.0e6;
asprintf (&msg,
- _("HTTP problem: %s - %.3f second response time %s%s|%s size=%dB\n"),
+ _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (pagesize));
if (check_critical_time == TRUE && elapsed_time > critical_time)
die (STATE_CRITICAL, "%s", msg);
if (check_warning_time == TRUE && elapsed_time > warning_time)
if (strlen (string_expect)) {
if (strstr (page, string_expect)) {
- printf (_("HTTP OK %s - %.3f second response time %s%s|%s size=%dB\n"),
+ printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time,
timestamp, (display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (pagesize));
exit (STATE_OK);
}
else {
- printf (_("CRITICAL - string not found%s|%s size=%dB\n"),
+ printf (_("CRITICAL - string not found%s|%s %s\n"),
(display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (pagesize));
exit (STATE_CRITICAL);
}
}
if (strlen (regexp)) {
errcode = regexec (&preg, page, REGS, pmatch, 0);
if (errcode == 0) {
- printf (_("HTTP OK %s - %.3f second response time %s%s|%s size=%dB\n"),
+ printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time,
timestamp, (display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (pagesize));
exit (STATE_OK);
}
else {
if (errcode == REG_NOMATCH) {
- printf (_("CRITICAL - pattern not found%s|%s size=%dB\n"),
+ printf (_("CRITICAL - pattern not found%s|%s %s\n"),
(display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (pagesize));
exit (STATE_CRITICAL);
}
else {
/* 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 );
+ printf (_("HTTP WARNING: page size %d too small%s|%s\n"),
+ page_len, (display_html ? "</A>" : ""), perfd_size (page_len) );
exit (STATE_WARNING);
}
/* We only get here if all tests have been passed */
- asprintf (&msg, _("HTTP OK %s - %.3f second response time %s%s|%s size=%dB\n"),
- status_line, elapsed_time,
+ asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s%s|%s %s\n"),
+ status_line, page_len, elapsed_time,
timestamp, (display_html ? "</A>" : ""),
- perfd_time (microsec), pagesize);
+ perfd_time (microsec), perfd_size (page_len));
die (STATE_OK, "%s", msg);
return STATE_UNKNOWN;
}
char *perfd_time (long microsec)
{
- perfdata ("time", microsec, "us",
+ return perfdata ("time", microsec, "us",
check_warning_time, (int)(1e6*warning_time),
check_critical_time, (int)(1e6*critical_time),
TRUE, 0, FALSE, 0);
}
+
+char *perfd_size (int page_len)
+{
+ return perfdata ("size", page_len, "B",
+ (min_page_len>0?TRUE:FALSE), min_page_len,
+ (min_page_len>0?TRUE:FALSE), 0,
+ TRUE, 0, FALSE, 0);
+}
+
+
int
my_recv (void)
{