diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-19 06:24:08 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-19 06:24:08 +0000 |
commit | ead766539bb6977548a255bb43a1b8bdf4a22cd6 (patch) | |
tree | fab30807254818e74e89f2b748484173e92386f6 /plugins/check_time.c | |
parent | 3a359d9d90ff680c3bc9308752e14f71b02b31fd (diff) | |
download | monitoring-plugins-ead766539bb6977548a255bb43a1b8bdf4a22cd6.tar.gz |
add perfdata
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@773 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_time.c')
-rw-r--r-- | plugins/check_time.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/plugins/check_time.c b/plugins/check_time.c index f73005d5..0de6718b 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -54,6 +54,7 @@ main (int argc, char **argv) { int sd; int result; + time_t conntime; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); @@ -127,14 +128,19 @@ main (int argc, char **argv) result = STATE_OK; - if (check_critical_time == TRUE && (end_time - start_time) > critical_time) + conntime = (end_time - start_time); + if (check_critical_time == TRUE && conntime > critical_time) result = STATE_CRITICAL; - else if (check_warning_time == TRUE - && (end_time - start_time) > warning_time) result = STATE_WARNING; + else if (check_warning_time == TRUE && conntime > warning_time) + result = STATE_WARNING; if (result != STATE_OK) - die (result, _("TIME %s - %d second response time\n"), - state_text (result), (int) (end_time - start_time)); + die (result, _("TIME %s - %d second response time|%s\n"), + state_text (result), (int)conntime, + perfdata ("time", (long)conntime, "s", + check_warning_time, (long)warning_time, + check_critical_time, (long)critical_time, + TRUE, 0, FALSE, 0)); server_time = ntohl (raw_server_time) - UNIX_EPOCH; if (server_time > (unsigned long)end_time) @@ -147,8 +153,16 @@ main (int argc, char **argv) else if (check_warning_diff == TRUE && diff_time > (time_t)warning_diff) result = STATE_WARNING; - printf (_("TIME %s - %lu second time difference\n"), state_text (result), - diff_time); + printf (_("TIME %s - %lu second time difference|%s %s\n"), + state_text (result), diff_time, + perfdata ("time", (long)conntime, "s", + check_warning_time, (long)warning_time, + check_critical_time, (long)critical_time, + TRUE, 0, FALSE, 0), + perfdata ("offset", (long)diff_time, "s", + check_warning_diff, (long)warning_diff, + check_critical_diff, (long)critical_diff, + TRUE, 0, FALSE, 0)); return result; } |