[Nagios-devel] Re: Bug - Double Log Rotates

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Re: Bug - Double Log Rotates

Post by Guest »

Hello,

I'm a little bit late, but I've seen in the archive the mail from Scott
Brynen ( http://sourceforge.net/mailarchive/mess ... id=9215796
) about the double log rotation bug when the system clock is
compensated backward.

I still have the same problem (Nagios v1.2), and I thought the simple
following patch could help. (Or has this been handled in v2.0, or
anywhere else?)

The idea is quite simple, just do not adjust log rotation events (as
they must occur at an absolute time, not relative). It's one more "if",
following diff with context:

nagios-1.2/base # diff -c nagios.c.old nagios.c
*** nagios.c.old Tue Sep 20 18:16:05 2005
--- nagios.c Tue Sep 20 18:17:44 2005
***************
*** 1827,1846 ****
/* adjust the next run time for all high priority timed events
*/

for(temp_event=event_list_high;temp_event!=NULL;temp_event=temp_event-
>next){

! /* we moved back in time... */
! if(last_time>current_time){
!
! /* we can't precede the UNIX epoch */
! if(time_difference>(unsigned
long)temp_event->run_time)
! temp_event->run_time=(time_t)0;
! else
!
temp_event->run_time=(time_t)(temp_event->run_time-
(time_t)time_difference);
! }
!
! /* we moved into the future... */
! else
!
temp_event->run_time=(time_t)(temp_event-
>run_time+(time_t)time_difference);
! }

/* adjust the next run time for all low priority timed events */

for(temp_event=event_list_low;temp_event!=NULL;temp_event=temp_event-
>next){
--- 1827,1848 ----
/* adjust the next run time for all high priority timed events
*/

for(temp_event=event_list_high;temp_event!=NULL;temp_event=temp_event-
>next){

! if(temp_event->event_type!=EVENT_LOG_ROTATION){
! /* we moved back in time... */
! if(last_time>current_time){
!
! /* we can't precede the UNIX epoch */
! if(time_difference>(unsigned long)temp_event->run_time)
! temp_event->run_time=(time_t)0;
! else
!
temp_event->run_time=(time_t)(temp_event->run_time-
(time_t)time_difference);
! }
!
! /* we moved into the future... */
! else
!
temp_event->run_time=(time_t)(temp_event-
>run_time+(time_t)time_difference);
! }
! }

/* adjust the next run time for all low priority timed events */

for(temp_event=event_list_low;temp_event!=NULL;temp_event=temp_event-
>next){



Any feedback/flame is welcomed!

Steph






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked