<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.24">
<TITLE>FW: Problem with initial service scheduling (2.0b3)</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Sorry for posting this message again but I cannot modify my production environment before having an opinion from somebody who understands the 'interleave_block' stuff.</FONT></P>

<P><FONT SIZE=2>Thanks in advance</FONT>
</P>

<P><FONT SIZE=2>> -----Original Message-----</FONT>
<BR><FONT SIZE=2>> From: Laupretre, François (CALYON) </FONT>
<BR><FONT SIZE=2>> Sent: Thursday, June 09, 2005 2:56 PM</FONT>
<BR><FONT SIZE=2>> To: nagios-devel@lists.sourceforge.net</FONT>
<BR><FONT SIZE=2>> Subject: Problem with initial service scheduling (2.0b3)</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Hi all,</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> I currently have a configuration with 4800 services : 600 </FONT>
<BR><FONT SIZE=2>> active and 4200 passive. And, as the number was growing, I </FONT>
<BR><FONT SIZE=2>> noticed a problem in the way nagios scheduled their initial </FONT>
<BR><FONT SIZE=2>> check time : With the 2.0b3 original code, with </FONT>
<BR><FONT SIZE=2>> max_service_check_spread=30, when I look at the scheduling </FONT>
<BR><FONT SIZE=2>> queue just after start, I see that the last service checks </FONT>
<BR><FONT SIZE=2>> are scheduled to run in 4 hours !</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> This delay corresponds to :</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> max_service_check_spread * (total_services / total_scheduled_services)</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> And should be equal to max_service_check_spread.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> I found the reason in event.c/init_timing_loop() and I am </FONT>
<BR><FONT SIZE=2>> including a change which appears to correct the problem but, </FONT>
<BR><FONT SIZE=2>> as I am not sure to fully understand the 'interleave_block' </FONT>
<BR><FONT SIZE=2>> logic, this change should be taken with care :</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> The reason : in the 'schedule service checks' section of </FONT>
<BR><FONT SIZE=2>> init_timing_loop(), next check time is incremented for each </FONT>
<BR><FONT SIZE=2>> service, and not for each SCHEDULED service. So, in my case </FONT>
<BR><FONT SIZE=2>> it is incremented 'total_services' times and the last check </FONT>
<BR><FONT SIZE=2>> time is equal to :</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Current_time + total_services * service_inter_check_delay</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Where it should be :</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Current_time + total_scheduled_services * service_inter_check_delay</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Which is coherent with the way service_inter_check_delay is computed.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> My change consists of taking the 'should_be_scheduled' check </FONT>
<BR><FONT SIZE=2>> out of the inner loop, and add a line in order to have the </FONT>
<BR><FONT SIZE=2>> code enter the inner 'interleave_block' loop only for active </FONT>
<BR><FONT SIZE=2>> checks. This way current_interleave_block goes from 0 to </FONT>
<BR><FONT SIZE=2>> total_schedules_services instead of going up to total_services.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Once again, the patch I am submitting seems to correct the </FONT>
<BR><FONT SIZE=2>> problem in MY case. But I don't know if it is correct when </FONT>
<BR><FONT SIZE=2>> interleave variables have some different values.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Regards</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> François</FONT>
<BR><FONT SIZE=2>> </FONT>
</P>

</BODY>
</HTML>