Re: [Nagios-devel] Strange service scheduling

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

Re: [Nagios-devel] Strange service scheduling

Post by Guest »

Hi,

----- "Hendrik Baecker" escreveu:
> Are you shure that the problem hits us, when the calculation is
> 'inside'
> a timeperiod?

If I send a valid timestamp to get_next_valid_time it will return the same valid time.
Take a look to base/checks.c at line 280:

get_next_valid_time(preferred_time,&next_valid_time,svc->check_period_ptr);

Suppose preferred_time is a valid timestamp within svc->check_period_ptr.
What is supposed to return from this call?

I supposed the return is: next_valid_time = preferred_time.

Look, some lines below we found:

if (time_is_valid==FALSE && next_valid_time==preferred_time) {
//schedule this check for next year
}

time_is_valid = FALSE can be achieved with a timeperiod change.
Lets try with an example:

service X, timeperiod 24x7, check_interval is 5 minutes;
Nagios is running and the next check for X is scheduled to 11:48.
So, somebody change the timeperiod of service X to 11:50-23:00.

When the next check runs, time_is_valid will become FALSE because 11:48 is OUT of new timeperiod.
Prefered time is calculed to 11:53 and we run get_next_valid_time passing prefered_time, that returns 11:53.

The code below is self explained:
if (time_is_valid==FALSE && next_valid_time==preferred_time) {
//schedule this check for next year
}

I propose to use

get_next_valid_time(current_time,&next_valid_time,svc->check_period_ptr);

not

get_next_valid_time(preferred_time,&next_valid_time,svc->check_period_ptr);

I will do this patch against development release and send again to list.

-rm





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