187 | 187 |
/* adjust the check interval total to correspond to the interval length */
|
188 | 188 |
scheduling_info.service_check_interval_total
|
189 | 189 |
= scheduling_info.service_check_interval_total
|
190 | |
* config->interval_length();
|
|
190 |
* ::interval_length;
|
191 | 191 |
|
192 | 192 |
/* calculate the average check interval for services */
|
193 | 193 |
if (scheduling_info.total_scheduled_services == 0)
|
|
205 | 205 |
|
206 | 206 |
/* default max service check spread (in minutes) */
|
207 | 207 |
scheduling_info.max_service_check_spread
|
208 | |
= config->max_service_check_spread();
|
|
208 |
= ::max_service_check_spread;
|
209 | 209 |
|
210 | 210 |
/* how should we determine the service inter-check delay to use? */
|
211 | |
switch (config->service_inter_check_delay_method()) {
|
|
211 |
switch (::service_inter_check_delay_method) {
|
212 | 212 |
|
213 | 213 |
case configuration::state::icd_none:
|
214 | 214 |
/* don't spread checks out - useful for testing parallelization code */
|
|
263 | 263 |
}
|
264 | 264 |
|
265 | 265 |
/* how should we determine the service interleave factor? */
|
266 | |
switch (config->service_interleave_factor_method()) {
|
|
266 |
switch (::service_interleave_factor_method) {
|
267 | 267 |
|
268 | 268 |
case configuration::state::ilf_user:
|
269 | 269 |
/* the user supplied a value, so don't do any calculation */
|
|
459 | 459 |
|
460 | 460 |
/* default max host check spread (in minutes) */
|
461 | 461 |
scheduling_info.max_host_check_spread
|
462 | |
= config->max_host_check_spread();
|
|
462 |
= ::max_host_check_spread;
|
463 | 463 |
|
464 | 464 |
/* how should we determine the host inter-check delay to use? */
|
465 | |
switch (config->host_inter_check_delay_method()) {
|
|
465 |
switch (::host_inter_check_delay_method) {
|
466 | 466 |
case configuration::state::icd_none:
|
467 | 467 |
/* don't spread checks out */
|
468 | 468 |
scheduling_info.host_inter_check_delay = 0.0;
|
|
485 | 485 |
|
486 | 486 |
/* adjust the check interval total to correspond to the interval length */
|
487 | 487 |
scheduling_info.host_check_interval_total
|
488 | |
= scheduling_info.host_check_interval_total * config->interval_length();
|
|
488 |
= scheduling_info.host_check_interval_total * ::interval_length;
|
489 | 489 |
|
490 | 490 |
/* calculate the average check interval for hosts */
|
491 | 491 |
scheduling_info.average_host_check_interval
|
|
634 | 634 |
|
635 | 635 |
/******** SCHEDULE MISC EVENTS ********/
|
636 | 636 |
|
637 | |
/* add a host and service check rescheduling event */
|
638 | |
if (config->auto_reschedule_checks() == true)
|
639 | |
schedule_new_event(
|
640 | |
EVENT_RESCHEDULE_CHECKS,
|
641 | |
true,
|
642 | |
current_time + config->auto_rescheduling_interval(),
|
643 | |
true,
|
644 | |
config->auto_rescheduling_interval(),
|
645 | |
NULL,
|
646 | |
true,
|
647 | |
NULL,
|
648 | |
NULL,
|
649 | |
0);
|
650 | |
|
651 | 637 |
/* add a check result reaper event */
|
652 | 638 |
schedule_new_event(
|
653 | 639 |
EVENT_CHECK_REAPER,
|
654 | 640 |
true,
|
655 | |
current_time + config->check_reaper_interval(),
|
|
641 |
current_time + ::check_reaper_interval,
|
656 | 642 |
true,
|
657 | |
config->check_reaper_interval(),
|
|
643 |
::check_reaper_interval,
|
658 | 644 |
NULL,
|
659 | 645 |
true,
|
660 | 646 |
NULL,
|
661 | 647 |
NULL,
|
662 | 648 |
0);
|
663 | 649 |
|
|
650 |
/* add an external command check event if needed */
|
|
651 |
if (::check_external_commands == true) {
|
|
652 |
if (::command_check_interval == -1)
|
|
653 |
interval_to_use = (unsigned long)5;
|
|
654 |
else
|
|
655 |
interval_to_use = (unsigned long)::command_check_interval;
|
|
656 |
schedule_new_event(
|
|
657 |
EVENT_COMMAND_CHECK,
|
|
658 |
true,
|
|
659 |
current_time + interval_to_use,
|
|
660 |
true,
|
|
661 |
interval_to_use,
|
|
662 |
NULL,
|
|
663 |
true,
|
|
664 |
NULL,
|
|
665 |
NULL,
|
|
666 |
0);
|
|
667 |
}
|
|
668 |
|
|
669 |
/* add a host result "freshness" check event */
|
|
670 |
if (::check_host_freshness == true)
|
|
671 |
schedule_new_event(
|
|
672 |
EVENT_HFRESHNESS_CHECK,
|
|
673 |
true,
|
|
674 |
current_time + ::host_freshness_check_interval,
|
|
675 |
true,
|
|
676 |
::host_freshness_check_interval,
|
|
677 |
NULL,
|
|
678 |
true,
|
|
679 |
NULL,
|
|
680 |
NULL,
|
|
681 |
0);
|
|
682 |
|
664 | 683 |
/* add an orphaned check event */
|
665 | |
if (config->check_orphaned_services() == true
|
666 | |
|| config->check_orphaned_hosts() == true)
|
|
684 |
if (::check_orphaned_services == true
|
|
685 |
|| ::check_orphaned_hosts == true)
|
667 | 686 |
schedule_new_event(
|
668 | 687 |
EVENT_ORPHAN_CHECK,
|
669 | 688 |
true,
|
|
676 | 695 |
NULL,
|
677 | 696 |
0);
|
678 | 697 |
|
|
698 |
/* add a host and service check rescheduling event */
|
|
699 |
if (::auto_reschedule_checks == true)
|
|
700 |
schedule_new_event(
|
|
701 |
EVENT_RESCHEDULE_CHECKS,
|
|
702 |
true,
|
|
703 |
current_time + ::auto_rescheduling_interval,
|
|
704 |
true,
|
|
705 |
::auto_rescheduling_interval,
|
|
706 |
NULL,
|
|
707 |
true,
|
|
708 |
NULL,
|
|
709 |
NULL,
|
|
710 |
0);
|
|
711 |
|
|
712 |
/* add a retention data save event if needed */
|
|
713 |
if (::retain_state_information == true
|
|
714 |
&& ::retention_update_interval > 0)
|
|
715 |
schedule_new_event(
|
|
716 |
EVENT_RETENTION_SAVE,
|
|
717 |
true,
|
|
718 |
current_time + (::retention_update_interval * 60),
|
|
719 |
true,
|
|
720 |
(::retention_update_interval * 60),
|
|
721 |
NULL,
|
|
722 |
true,
|
|
723 |
NULL,
|
|
724 |
NULL,
|
|
725 |
0);
|
|
726 |
|
679 | 727 |
/* add a service result "freshness" check event */
|
680 | |
if (config->check_service_freshness() == true)
|
|
728 |
if (::check_service_freshness == true)
|
681 | 729 |
schedule_new_event(
|
682 | 730 |
EVENT_SFRESHNESS_CHECK,
|
683 | 731 |
true,
|
684 | |
current_time + config->service_freshness_check_interval(),
|
685 | |
true,
|
686 | |
config->service_freshness_check_interval(),
|
687 | |
NULL,
|
688 | |
true,
|
689 | |
NULL,
|
690 | |
NULL,
|
691 | |
0);
|
692 | |
|
693 | |
/* add a host result "freshness" check event */
|
694 | |
if (config->check_host_freshness() == true)
|
695 | |
schedule_new_event(
|
696 | |
EVENT_HFRESHNESS_CHECK,
|
697 | |
true,
|
698 | |
current_time + config->host_freshness_check_interval(),
|
699 | |
true,
|
700 | |
config->host_freshness_check_interval(),
|
|
732 |
current_time + ::service_freshness_check_interval,
|
|
733 |
true,
|
|
734 |
::service_freshness_check_interval,
|
701 | 735 |
NULL,
|
702 | 736 |
true,
|
703 | 737 |
NULL,
|
|
708 | 742 |
schedule_new_event(
|
709 | 743 |
EVENT_STATUS_SAVE,
|
710 | 744 |
true,
|
711 | |
current_time + config->status_update_interval(),
|
|
745 |
current_time + ::status_update_interval,
|
712 | 746 |
true,
|
713 | |
config->status_update_interval(),
|
|
747 |
::status_update_interval,
|
714 | 748 |
NULL,
|
715 | 749 |
true,
|
716 | 750 |
NULL,
|
717 | 751 |
NULL,
|
718 | 752 |
0);
|
719 | |
|
720 | |
/* add an external command check event if needed */
|
721 | |
if (config->check_external_commands() == true) {
|
722 | |
if (config->command_check_interval() == -1)
|
723 | |
interval_to_use = (unsigned long)5;
|
724 | |
else
|
725 | |
interval_to_use = (unsigned long)config->command_check_interval();
|
726 | |
schedule_new_event(
|
727 | |
EVENT_COMMAND_CHECK,
|
728 | |
true,
|
729 | |
current_time + interval_to_use,
|
730 | |
true,
|
731 | |
interval_to_use,
|
732 | |
NULL,
|
733 | |
true,
|
734 | |
NULL,
|
735 | |
NULL,
|
736 | |
0);
|
737 | |
}
|
738 | |
|
739 | |
/* add a retention data save event if needed */
|
740 | |
if (config->retain_state_information() == true
|
741 | |
&& config->retention_update_interval() > 0)
|
742 | |
schedule_new_event(
|
743 | |
EVENT_RETENTION_SAVE,
|
744 | |
true,
|
745 | |
current_time + (config->retention_update_interval() * 60),
|
746 | |
true,
|
747 | |
(config->retention_update_interval() * 60),
|
748 | |
NULL,
|
749 | |
true,
|
750 | |
NULL,
|
751 | |
NULL,
|
752 | |
0);
|
753 | 753 |
|
754 | 754 |
if (test_scheduling == true) {
|
755 | 755 |
runtime[0]
|