diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-12 05:29:55 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-12 05:29:55 +0000 |
commit | a28ef8e438f4d45e6f3b1747a247b21d3e8d1482 (patch) | |
tree | fe60f0bd49dd75830b4fc4eeafb98db528e208cc /plugins/check_mrtgtraf.c | |
parent | d7fa39a3e0124b56dd65e3459c405af67193ace6 (diff) | |
download | monitoring-plugins-a28ef8e438f4d45e6f3b1747a247b21d3e8d1482.tar.gz |
add perfdata
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@765 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_mrtgtraf.c')
-rw-r--r-- | plugins/check_mrtgtraf.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index 93b2c1d0..8cc6ec3a 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c @@ -115,12 +115,10 @@ main (int argc, char **argv) /* make sure the MRTG data isn't too old */ time (¤t_time); - if (expire_minutes > 0 - && (current_time - timestamp) > - (expire_minutes * 60)) die (STATE_WARNING, - _("MRTG data has expired (%d minutes old)\n"), - (int) ((current_time - timestamp) / - 60)); + if ((expire_minutes > 0) && + (current_time - timestamp) > (expire_minutes * 60)) + die (STATE_WARNING, _("MRTG data has expired (%d minutes old)\n"), + (int) ((current_time - timestamp) / 60)); /* else check the incoming/outgoing rates */ if (use_average == TRUE) { @@ -171,26 +169,26 @@ main (int argc, char **argv) if (incoming_rate > incoming_critical_threshold || outgoing_rate > outgoing_critical_threshold) { result = STATE_CRITICAL; - asprintf (&error_message, _("Traffic CRITICAL %s. In = %0.1f %s, %s. Out = %0.1f %s"), - (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, - incoming_speed_rating, (use_average == TRUE) ? "Avg" : "Max", - adjusted_outgoing_rate, outgoing_speed_rating); } else if (incoming_rate > incoming_warning_threshold || outgoing_rate > outgoing_warning_threshold) { result = STATE_WARNING; - asprintf (&error_message, _("Traffic WARNING %s. In = %0.1f %s, %s. Out = %0.1f %s"), - (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, - incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), - adjusted_outgoing_rate, outgoing_speed_rating); } - else if (result == STATE_OK) - printf (_("Traffic OK - %s. In = %0.1f %s, %s. Out = %0.1f %s\n"), - (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, - incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), - adjusted_outgoing_rate, outgoing_speed_rating); - else - printf (_("UNKNOWN %s\n"), error_message); + + asprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f %s\n"), + (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, + incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), + adjusted_outgoing_rate, outgoing_speed_rating, + perfdata("in", adjusted_incoming_rate, incoming_speed_rating, + incoming_warning_threshold, incoming_warning_threshold, + incoming_critical_threshold, incoming_critical_threshold, + TRUE, 0, TRUE, incoming_speed_rating), + perfdata("in", adjusted_outgoing_rate, outgoing_speed_rating, + outgoing_warning_threshold, outgoing_warning_threshold, + outgoing_critical_threshold, outgoing_critical_threshold, + TRUE, 0, TRUE, outgoing_speed_rating)); + + printf (_("Traffic %s - %s\n"), state_text(result), error_message); return result; } |