summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7fa39a)
raw | patch | inline | side by side (parent: d7fa39a)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 12 Nov 2003 05:29:55 +0000 (05:29 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 12 Nov 2003 05:29:55 +0000 (05:29 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@765 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_mrtgtraf.c | patch | blob | history |
index 93b2c1d03fa569a9cb9fd6ed8257ae3a9dea74f3..8cc6ec3a6e433913904785b0e3aa80cbf7a7ffa9 100644 (file)
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
/* 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) {
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;
}