diff options
-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 93b2c1d..8cc6ec3 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
@@ -115,12 +115,10 @@ main (int argc, char **argv) | |||
115 | 115 | ||
116 | /* make sure the MRTG data isn't too old */ | 116 | /* make sure the MRTG data isn't too old */ |
117 | time (¤t_time); | 117 | time (¤t_time); |
118 | if (expire_minutes > 0 | 118 | if ((expire_minutes > 0) && |
119 | && (current_time - timestamp) > | 119 | (current_time - timestamp) > (expire_minutes * 60)) |
120 | (expire_minutes * 60)) die (STATE_WARNING, | 120 | die (STATE_WARNING, _("MRTG data has expired (%d minutes old)\n"), |
121 | _("MRTG data has expired (%d minutes old)\n"), | 121 | (int) ((current_time - timestamp) / 60)); |
122 | (int) ((current_time - timestamp) / | ||
123 | 60)); | ||
124 | 122 | ||
125 | /* else check the incoming/outgoing rates */ | 123 | /* else check the incoming/outgoing rates */ |
126 | if (use_average == TRUE) { | 124 | if (use_average == TRUE) { |
@@ -171,26 +169,26 @@ main (int argc, char **argv) | |||
171 | if (incoming_rate > incoming_critical_threshold | 169 | if (incoming_rate > incoming_critical_threshold |
172 | || outgoing_rate > outgoing_critical_threshold) { | 170 | || outgoing_rate > outgoing_critical_threshold) { |
173 | result = STATE_CRITICAL; | 171 | result = STATE_CRITICAL; |
174 | asprintf (&error_message, _("Traffic CRITICAL %s. In = %0.1f %s, %s. Out = %0.1f %s"), | ||
175 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, | ||
176 | incoming_speed_rating, (use_average == TRUE) ? "Avg" : "Max", | ||
177 | adjusted_outgoing_rate, outgoing_speed_rating); | ||
178 | } | 172 | } |
179 | else if (incoming_rate > incoming_warning_threshold | 173 | else if (incoming_rate > incoming_warning_threshold |
180 | || outgoing_rate > outgoing_warning_threshold) { | 174 | || outgoing_rate > outgoing_warning_threshold) { |
181 | result = STATE_WARNING; | 175 | result = STATE_WARNING; |
182 | asprintf (&error_message, _("Traffic WARNING %s. In = %0.1f %s, %s. Out = %0.1f %s"), | ||
183 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, | ||
184 | incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), | ||
185 | adjusted_outgoing_rate, outgoing_speed_rating); | ||
186 | } | 176 | } |
187 | else if (result == STATE_OK) | 177 | |
188 | printf (_("Traffic OK - %s. In = %0.1f %s, %s. Out = %0.1f %s\n"), | 178 | asprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f %s\n"), |
189 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, | 179 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, |
190 | incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), | 180 | incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), |
191 | adjusted_outgoing_rate, outgoing_speed_rating); | 181 | adjusted_outgoing_rate, outgoing_speed_rating, |
192 | else | 182 | perfdata("in", adjusted_incoming_rate, incoming_speed_rating, |
193 | printf (_("UNKNOWN %s\n"), error_message); | 183 | incoming_warning_threshold, incoming_warning_threshold, |
184 | incoming_critical_threshold, incoming_critical_threshold, | ||
185 | TRUE, 0, TRUE, incoming_speed_rating), | ||
186 | perfdata("in", adjusted_outgoing_rate, outgoing_speed_rating, | ||
187 | outgoing_warning_threshold, outgoing_warning_threshold, | ||
188 | outgoing_critical_threshold, outgoing_critical_threshold, | ||
189 | TRUE, 0, TRUE, outgoing_speed_rating)); | ||
190 | |||
191 | printf (_("Traffic %s - %s\n"), state_text(result), error_message); | ||
194 | 192 | ||
195 | return result; | 193 | return result; |
196 | } | 194 | } |