Title: [opsview-base] [224] Improved fix.
- Revision
- 224
- Author
- tvoon
- Date
- 2013-02-26 21:33:01 +0000 (Tue, 26 Feb 2013)
Log Message
Improved fix. This stops multiple calls being invoked for the log rotation
Modified Paths
Added Paths
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2013-02-26 20:33:13 UTC (rev 223)
+++ trunk/Makefile 2013-02-26 21:33:01 UTC (rev 224)
@@ -603,6 +603,7 @@
# End bugfixes (till 2013-02-26)
cd ${NAGIOS} && patch -p1 < ../patches/nagios_overcome_log_rotation_overwrites.patch
cd ${NAGIOS} && patch -p1 < ../patches/nagios_reentrant_localtime.patch
+ cd ${NAGIOS} && patch -p1 < ../patches/nagios_fix_multiple_log_rotations.patch
if [ $(KERNEL_NAME) = Linux ] ; then \
cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
elif [ $(KERNEL_NAME) = Darwin ] ; then \
Added: trunk/patches/nagios_fix_multiple_log_rotations.patch
===================================================================
--- trunk/patches/nagios_fix_multiple_log_rotations.patch (rev 0)
+++ trunk/patches/nagios_fix_multiple_log_rotations.patch 2013-02-26 21:33:01 UTC (rev 224)
@@ -0,0 +1,17 @@
+diff -ur nagios-4.0.20130107.original//base/utils.c nagios-4.0.20130107/base/utils.c
+--- nagios-4.0.20130107.original//base/utils.c 2013-02-26 17:10:48.000000000 +0000
++++ nagios-4.0.20130107/base/utils.c 2013-02-26 21:31:02.000000000 +0000
+@@ -1639,7 +1639,13 @@
+ int is_dst_now = FALSE;
+ time_t run_time;
+
++ // Opsview patch: Increment current_time by 2 because sometimes the log rotation event occurs 1 second before the actual time
++ // so this routine then returns back the same time again, thus getting multiple calls to the log rotation routine
++ // This started happening somewhere between Nagios 3.2.3 and Nagios 3.4.4.
++ // This is a hack - the event really should not get called earlier than expected
+ time(¤t_time);
++ current_time=current_time+2;
++
+ t = localtime_r(¤t_time, &tm_s);
+ t->tm_min = 0;
+ t->tm_sec = 0;
Modified: trunk/patches/nagios_overcome_log_rotation_overwrites.patch
===================================================================
--- trunk/patches/nagios_overcome_log_rotation_overwrites.patch 2013-02-26 20:33:13 UTC (rev 223)
+++ trunk/patches/nagios_overcome_log_rotation_overwrites.patch 2013-02-26 21:33:01 UTC (rev 224)
@@ -15,7 +15,7 @@
+ /* Opsview: There's a strange bug in Nagios 3.4.4 and Nagios 4 where the log rotation sometimes happens twice. We try to overcome it here */
+ current_time = time(NULL);
-+ if (current_time - last_log_rotation < 3000) {
++ if (current_time - last_log_rotation < 10) {
+ logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Another log rotation was requested for %lu. Last rotation at %lu, current time is %lu", rotation_time, last_log_rotation, current_time);
+ return ERROR;
+ }
_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins