[icinga-checkins] icinga.org: icinga-core/next: Reset is_flapping to FALSE when flapping is disabled for a host/service

git at icinga.org git at icinga.org
Wed Nov 26 14:11:52 CET 2014


Module: icinga-core
Branch: next
Commit: 0c089bfc2353fee876a5b09c8608424f843c365b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=0c089bfc2353fee876a5b09c8608424f843c365b

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Nov 26 14:10:36 2014 +0100

Reset is_flapping to FALSE when flapping is disabled for a host/service

fixes #7852

---

 base/flapping.c   |    6 ++++++
 base/sretention.c |   12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/base/flapping.c b/base/flapping.c
index 89e654d..e3ba07b 100644
--- a/base/flapping.c
+++ b/base/flapping.c
@@ -622,6 +622,9 @@ void disable_host_flap_detection(host *hst) {
 	/* set the flap detection enabled flag */
 	hst->flap_detection_enabled = FALSE;
 
+	/* reset flap detection status */
+	hst->is_flapping = FALSE;
+
 #ifdef USE_EVENT_BROKER
 	/* send data to event broker */
 	broker_adaptive_host_data(NEBTYPE_ADAPTIVEHOST_UPDATE, NEBFLAG_NONE, NEBATTR_NONE, hst, CMD_NONE, attr, hst->modified_attributes, NULL);
@@ -736,6 +739,9 @@ void disable_service_flap_detection(service *svc) {
 	/* set the flap detection enabled flag */
 	svc->flap_detection_enabled = FALSE;
 
+	/* reset flapping status */
+	svc->is_flapping = FALSE;
+
 #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);
diff --git a/base/sretention.c b/base/sretention.c
index 9c50d5a..b13de85 100644
--- a/base/sretention.c
+++ b/base/sretention.c
@@ -34,6 +34,8 @@
 #include "../include/broker.h"
 
 extern int            retain_state_information;
+extern host          *host_list;
+extern service       *service_list;
 
 
 
@@ -117,6 +119,8 @@ int save_state_information(int autosave) {
 /* reads in initial host and state information */
 int read_initial_state_information(void) {
 	int result = OK;
+	host *temp_host;
+	service *temp_service;
 
 	if (retain_state_information == FALSE)
 		return OK;
@@ -131,6 +135,14 @@ int read_initial_state_information(void) {
 	result = xrddefault_read_state_information();
 #endif
 
+	for (temp_host = host_list; temp_host != NULL; temp_host = temp_host->next)
+		if (!temp_host->flap_detection_enabled)
+			temp_host->is_flapping = FALSE;
+
+	for (temp_service = service_list; temp_service != NULL; temp_service = temp_service->next)
+		if (!temp_service->flap_detection_enabled)
+			temp_service->is_flapping = FALSE;
+
 #ifdef USE_EVENT_BROKER
 	/* send data to event broker */
 	broker_retention_data(NEBTYPE_RETENTIONDATA_ENDLOAD, NEBFLAG_NONE, NEBATTR_NONE, NULL);



More information about the icinga-checkins mailing list