Codebase list centreon-engine / 70ec388
Fix unit test. Alexandre Fouille 8 years ago
2 changed file(s) with 80 addition(s) and 80 deletion(s). Raw diff Collapse all Expand all
179179 unsigned int ocsp_timeout(15);
180180 unsigned int passive_host_checks_are_soft(false);
181181 unsigned int process_performance_data(false);
182 unsigned int retain_state_information(false);
182 unsigned int retain_state_information(true);
183183 unsigned int retention_scheduling_horizon(900);
184184 unsigned int retention_update_interval(60);
185185 unsigned int service_check_timeout(60);
187187 /* adjust the check interval total to correspond to the interval length */
188188 scheduling_info.service_check_interval_total
189189 = scheduling_info.service_check_interval_total
190 * config->interval_length();
190 * ::interval_length;
191191
192192 /* calculate the average check interval for services */
193193 if (scheduling_info.total_scheduled_services == 0)
205205
206206 /* default max service check spread (in minutes) */
207207 scheduling_info.max_service_check_spread
208 = config->max_service_check_spread();
208 = ::max_service_check_spread;
209209
210210 /* 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) {
212212
213213 case configuration::state::icd_none:
214214 /* don't spread checks out - useful for testing parallelization code */
263263 }
264264
265265 /* how should we determine the service interleave factor? */
266 switch (config->service_interleave_factor_method()) {
266 switch (::service_interleave_factor_method) {
267267
268268 case configuration::state::ilf_user:
269269 /* the user supplied a value, so don't do any calculation */
459459
460460 /* default max host check spread (in minutes) */
461461 scheduling_info.max_host_check_spread
462 = config->max_host_check_spread();
462 = ::max_host_check_spread;
463463
464464 /* 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) {
466466 case configuration::state::icd_none:
467467 /* don't spread checks out */
468468 scheduling_info.host_inter_check_delay = 0.0;
485485
486486 /* adjust the check interval total to correspond to the interval length */
487487 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;
489489
490490 /* calculate the average check interval for hosts */
491491 scheduling_info.average_host_check_interval
634634
635635 /******** SCHEDULE MISC EVENTS ********/
636636
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
651637 /* add a check result reaper event */
652638 schedule_new_event(
653639 EVENT_CHECK_REAPER,
654640 true,
655 current_time + config->check_reaper_interval(),
641 current_time + ::check_reaper_interval,
656642 true,
657 config->check_reaper_interval(),
643 ::check_reaper_interval,
658644 NULL,
659645 true,
660646 NULL,
661647 NULL,
662648 0);
663649
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
664683 /* 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)
667686 schedule_new_event(
668687 EVENT_ORPHAN_CHECK,
669688 true,
676695 NULL,
677696 0);
678697
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
679727 /* add a service result "freshness" check event */
680 if (config->check_service_freshness() == true)
728 if (::check_service_freshness == true)
681729 schedule_new_event(
682730 EVENT_SFRESHNESS_CHECK,
683731 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,
701735 NULL,
702736 true,
703737 NULL,
708742 schedule_new_event(
709743 EVENT_STATUS_SAVE,
710744 true,
711 current_time + config->status_update_interval(),
745 current_time + ::status_update_interval,
712746 true,
713 config->status_update_interval(),
747 ::status_update_interval,
714748 NULL,
715749 true,
716750 NULL,
717751 NULL,
718752 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);
753753
754754 if (test_scheduling == true) {
755755 runtime[0]