[Pkg-nagios-devel] nagios-plugins/debian/patches 00list, 1.7,
1.8 15_check_mrtg_wtf_conditionals.dpatch, NONE, 1.1
seanius at haydn.debian.org
seanius at haydn.debian.org
Sun Oct 9 15:45:43 UTC 2005
Update of /cvsroot/pkg-nagios/nagios-plugins/debian/patches
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv31196/debian/patches
Modified Files:
00list
Added Files:
15_check_mrtg_wtf_conditionals.dpatch
Log Message:
check_mrtg fix
Index: 00list
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios-plugins/debian/patches/00list,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- 00list 9 Oct 2005 15:02:15 -0000 1.7
+++ 00list 9 Oct 2005 15:45:40 -0000 1.8
@@ -4,3 +4,4 @@
12_check_mysql.c_mysql_options.dpatch
13_subst.in_again.dpatch
14_check_log_paths.dpatch
+15_check_mrtg_wtf_conditionals.dpatch
--- NEW FILE: 15_check_mrtg_wtf_conditionals.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14_check_log_paths.dpatch by <seanius at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins/check_mrtg.c nagios-plugins/plugins/check_mrtg.c
--- nagios-plugins~/plugins/check_mrtg.c 2004-12-26 00:17:44.000000000 +0100
+++ nagios-plugins/plugins/check_mrtg.c 2005-10-09 17:37:48.000000000 +0200
@@ -49,7 +49,6 @@
char input_buffer[MAX_INPUT_BUFFER];
char *temp_buffer;
time_t current_time;
- char* message;
time_t timestamp = 0L;
unsigned long average_value_rate = 0L;
unsigned long maximum_value_rate = 0L;
@@ -112,43 +111,37 @@
/* if we couldn't read enough data, return an unknown error */
if (line <= 2) {
- result = STATE_UNKNOWN;
- asprintf (&message, _("Unable to process MRTG log file\n"));
+ printf (_("Unable to process MRTG log file\n"));
+ return STATE_UNKNOWN;
}
/* make sure the MRTG data isn't too old */
- if (result == STATE_OK) {
- time (¤t_time);
- if (expire_minutes > 0
- && (current_time - timestamp) > (expire_minutes * 60)) {
- result = STATE_WARNING;
- asprintf (&message, _("MRTG data has expired (%d minutes old)\n"),
- (int) ((current_time - timestamp) / 60));
- }
+ time (¤t_time);
+ if (expire_minutes > 0
+ && (current_time - timestamp) > (expire_minutes * 60)) {
+ printf (_("MRTG data has expired (%d minutes old)\n"),
+ (int) ((current_time - timestamp) / 60));
+ return STATE_WARNING;
}
/* else check the incoming/outgoing rates */
- if (result == STATE_OK) {
- if (use_average == TRUE)
- rate = average_value_rate;
- else
- rate = maximum_value_rate;
-
- if (rate > value_critical_threshold)
- result = STATE_CRITICAL;
- else if (rate > value_warning_threshold)
- result = STATE_WARNING;
+ if (use_average == TRUE)
+ rate = average_value_rate;
+ else
+ rate = maximum_value_rate;
- asprintf (&message, "%s. %s = %lu %s|%s",
- (use_average == TRUE) ? _("Avg") : _("Max"),
- label, rate, units,
- perfdata(label, (long) rate, units,
- (int) value_warning_threshold, (long) value_warning_threshold,
- (int) value_critical_threshold, (long) value_critical_threshold,
- 0, 0, 0, 0));
- }
+ if (rate > value_critical_threshold)
+ result = STATE_CRITICAL;
+ else if (rate > value_warning_threshold)
+ result = STATE_WARNING;
- printf ("%s\n", message);
+ printf("%s. %s = %lu %s|%s\n",
+ (use_average == TRUE) ? _("Avg") : _("Max"),
+ label, rate, units,
+ perfdata(label, (long) rate, units,
+ (int) value_warning_threshold, (long) value_warning_threshold,
+ (int) value_critical_threshold, (long) value_critical_threshold,
+ 0, 0, 0, 0));
return result;
}
More information about the Pkg-nagios-devel
mailing list