summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d87bf2)
raw | patch | inline | side by side (parent: 3d87bf2)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 3 Mar 2004 12:33:15 +0000 (12:33 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 3 Mar 2004 12:33:15 +0000 (12:33 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@841 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_http.c | patch | blob | history | |
plugins/utils.c | patch | blob | history |
diff --git a/plugins/check_http.c b/plugins/check_http.c
index b676eec50331bac8c4a29e29ee13cac2b8183d39..54bbf0027a827c3d876bbbdc991953c1706cc724 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
void redir (char *pos, char *status_line);
int server_type_check(const char *type);
int server_port_check(int ssl_flag);
-char *perfd_time (long microsec);
+char *perfd_time (double microsec);
char *perfd_size (int page_len);
int my_recv (void);
int my_close (void);
_(" - %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""),
- perfd_time (microsec), perfd_size (pagesize));
+ perfd_time (elapsed_time), perfd_size (pagesize));
} /* end if (http_status >= 300) */
} /* end else (server_expect_yn) */
_("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""),
- perfd_time (microsec), perfd_size (pagesize));
+ perfd_time (elapsed_time), 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)
printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time,
timestamp, (display_html ? "</A>" : ""),
- perfd_time (microsec), perfd_size (pagesize));
+ perfd_time (elapsed_time), perfd_size (pagesize));
exit (STATE_OK);
}
else {
printf (_("CRITICAL - string not found%s|%s %s\n"),
(display_html ? "</A>" : ""),
- perfd_time (microsec), perfd_size (pagesize));
+ perfd_time (elapsed_time), perfd_size (pagesize));
exit (STATE_CRITICAL);
}
}
printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time,
timestamp, (display_html ? "</A>" : ""),
- perfd_time (microsec), perfd_size (pagesize));
+ perfd_time (elapsed_time), perfd_size (pagesize));
exit (STATE_OK);
}
else {
if (errcode == REG_NOMATCH) {
printf (_("CRITICAL - pattern not found%s|%s %s\n"),
(display_html ? "</A>" : ""),
- perfd_time (microsec), perfd_size (pagesize));
+ perfd_time (elapsed_time), perfd_size (pagesize));
exit (STATE_CRITICAL);
}
else {
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), perfd_size (page_len));
+ perfd_time (elapsed_time), perfd_size (page_len));
die (STATE_OK, "%s", msg);
return STATE_UNKNOWN;
}
\f
-char *perfd_time (long microsec)
+char *perfd_time (double elapsed_time)
{
- return perfdata ("time", microsec, "us",
- check_warning_time, (int)(1e6*warning_time),
- check_critical_time, (int)(1e6*critical_time),
- TRUE, 0, FALSE, 0);
+ return fperfdata ("time", elapsed_time, "s",
+ check_warning_time, warning_time,
+ check_critical_time, critical_time,
+ TRUE, 0, FALSE, 0);
}
diff --git a/plugins/utils.c b/plugins/utils.c
index 77e2e27955f33c77fd981052161e5229bb179810..bb380301a639aa899c228725cbe3cf425b7aae42 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
char *data = NULL;
if (strpbrk (label, "'= "))
- asprintf (&data, "'%s'=%ld%s;", label, val, uom);
+ asprintf (&data, "'%s'=", label);
else
- asprintf (&data, "%s=%ld%s;", label, val, uom);
+ asprintf (&data, "%s=", label);
+
+ asprintf (&data, "%s%f", data, val);
+ asprintf (&data, "%s%s;", data, uom);
if (warnp)
- asprintf (&data, "%s%ld;", data, warn);
- else
- asprintf (&data, "%s;", data);
+ asprintf (&data, "%s%f", data, warn);
+
+ asprintf (&data, "%s;", data);
if (critp)
- asprintf (&data, "%s%ld;", data, crit);
- else
- asprintf (&data, "%s;", data);
+ asprintf (&data, "%s%f", data, crit);
+
+ asprintf (&data, "%s;", data);
if (minp)
- asprintf (&data, "%s%ld", data, minv);
+ asprintf (&data, "%s%f", data, minv);
- if (maxp)
- asprintf (&data, "%s;%ld", data, maxv);
+ if (maxp) {
+ asprintf (&data, "%s;", data);
+ asprintf (&data, "%s%f", data, maxv);
+ }
return data;
}