/* enables flap detection for a specific service */ void enable_service_flap_detection(service *svc) { unsigned long attr = MODATTR_FLAP_DETECTION_ENABLED; log_debug_info(DEBUGL_FUNCTIONS, 0, "enable_service_flap_detection()\n"); if (svc == NULL) return; log_debug_info(DEBUGL_FLAPPING, 1, "Enabling flap detection for service '%s' on host '%s'.\n", svc->description, svc->host_name); /* nothing to do... */ if (svc->flap_detection_enabled == TRUE) return; /* set the attribute modified flag */ svc->modified_attributes |= attr; /* set the flap detection enabled flag */ svc->flap_detection_enabled = TRUE; #ifdef USE_EVENT_BROKER /* send data to event broker */ broker_adaptive_service_data(NEBTYPE_ADAPTIVESERVICE_UPDATE, NEBFLAG_NONE, NEBATTR_NONE, svc, CMD_NONE, attr, svc->modified_attributes, NULL); #endif /* check for flapping */ check_for_service_flapping(svc, FALSE, TRUE); /* update service status */ update_service_status(svc, FALSE); return; }
/* enables flap detection on a program wide basis */ void enable_flap_detection_routines(void) { unsigned int i; unsigned long attr = MODATTR_FLAP_DETECTION_ENABLED; log_debug_info(DEBUGL_FUNCTIONS, 0, "enable_flap_detection_routines()\n"); /* bail out if we're already set */ if (enable_flap_detection == TRUE) return; /* set the attribute modified flag */ modified_host_process_attributes |= attr; modified_service_process_attributes |= attr; /* set flap detection flag */ enable_flap_detection = TRUE; #ifdef USE_EVENT_BROKER /* send data to event broker */ broker_adaptive_program_data(NEBTYPE_ADAPTIVEPROGRAM_UPDATE, NEBFLAG_NONE, NEBATTR_NONE, CMD_NONE, attr, modified_host_process_attributes, attr, modified_service_process_attributes, NULL); #endif /* update program status */ update_program_status(FALSE); /* check for flapping */ for (i = 0; i < num_objects.hosts; i++) check_for_host_flapping(host_ary[i], FALSE, FALSE, TRUE); for (i = 0; i < num_objects.services; i++) check_for_service_flapping(service_ary[i], FALSE, TRUE); }
/* enables flap detection on a program wide basis */ void enable_flap_detection_routines(void) { host *temp_host = NULL; service *temp_service = NULL; unsigned long attr = MODATTR_FLAP_DETECTION_ENABLED; log_debug_info(DEBUGL_FUNCTIONS, 0, "enable_flap_detection_routines()\n"); /* bail out if we're already set */ if (enable_flap_detection == TRUE) return; /* set the attribute modified flag */ modified_host_process_attributes |= attr; modified_service_process_attributes |= attr; /* set flap detection flag */ enable_flap_detection = TRUE; #ifdef USE_EVENT_BROKER /* send data to event broker */ broker_adaptive_program_data(NEBTYPE_ADAPTIVEPROGRAM_UPDATE, NEBFLAG_NONE, NEBATTR_NONE, CMD_NONE, attr, modified_host_process_attributes, attr, modified_service_process_attributes, NULL); #endif /* update program status */ update_program_status(FALSE); /* check for flapping */ for (temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) check_for_host_flapping(temp_host, FALSE, FALSE, TRUE); for (temp_service = service_list; temp_service != NULL; temp_service = temp_service->next) check_for_service_flapping(temp_service, FALSE, TRUE); return; }
/* enables flap detection on a program wide basis */ void enable_flap_detection_routines(void) { unsigned int i; unsigned long attr = MODATTR_FLAP_DETECTION_ENABLED; /* bail out if we're already set */ if (enable_flap_detection == TRUE) return; /* set the attribute modified flag */ modified_host_process_attributes |= attr; modified_service_process_attributes |= attr; /* set flap detection flag */ enable_flap_detection = TRUE; broker_adaptive_program_data(NEBTYPE_ADAPTIVEPROGRAM_UPDATE, NEBFLAG_NONE, NEBATTR_NONE, CMD_NONE, attr, modified_host_process_attributes, attr, modified_service_process_attributes); /* update program status */ update_program_status(FALSE); /* check for flapping */ for (i = 0; i < num_objects.hosts; i++) check_for_host_flapping(host_ary[i], FALSE, FALSE); for (i = 0; i < num_objects.services; i++) check_for_service_flapping(service_ary[i], FALSE); }