[icinga-checkins] icinga.org: icinga-core/test/core: * core: do not dump retained host state states to neb modules, re-enable via dump_retained_host_service_states_to_neb #1742

git at icinga.org git at icinga.org
Fri Jul 22 19:17:51 CEST 2011


Module: icinga-core
Branch: test/core
Commit: 6280ccbc8216854b35148d1c280d2bd2b919fc1b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=6280ccbc8216854b35148d1c280d2bd2b919fc1b

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Fri Jul 22 19:02:05 2011 +0200

* core: do not dump retained host state states to neb modules, re-enable via dump_retained_host_service_states_to_neb #1742

Icinga IDOUtils keep their state already within the database
during reload/restart, so this information remains useless until
someone starts the core after a long time again - then it will
take at least one check cycle to receive current state data.

people using retained data should think of re-enabling it for
compatibility with other neb modules.

refs #1742

---

 Changelog                   |    1 +
 base/config.c               |   12 ++++++++++++
 base/icinga.c               |    1 +
 base/utils.c                |    2 ++
 sample-config/icinga.cfg.in |   12 ++++++++++++
 xdata/xrddefault.c          |   22 ++++++++++++++++++----
 6 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 9f44a26..a227faa 100644
--- a/Changelog
+++ b/Changelog
@@ -58,6 +58,7 @@ FIXES
 * core: fix flexible downtime on service hard state change doesn't get triggered/activated #1128
 * core: fix timeperiods daylight saving time problem (Luca Di Stefano) #1370
 * core: do not update host/service status during scheduler initialization on startup #1741
+* core: do not dump retained host state states to neb modules, re-enable via dump_retained_host_service_states_to_neb #1742
 
 * classic ui: Fixing tooltip's in status.cgi, not showing messages with carriage return #1244
 * classic ui: fixed csv export link to make it XSS save (IE) #1275
diff --git a/base/config.c b/base/config.c
index fe4b681..59667da 100644
--- a/base/config.c
+++ b/base/config.c
@@ -140,6 +140,7 @@ extern int      soft_state_dependencies;
 extern int      retain_state_information;
 extern int      retention_update_interval;
 extern int      use_retained_program_state;
+extern int	dump_retained_host_service_states_to_neb;
 extern int      use_retained_scheduling_info;
 extern int      retention_scheduling_horizon;
 extern unsigned long retained_host_attribute_mask;
@@ -713,6 +714,17 @@ int read_main_config_file(char *main_config_file){
 			use_retained_program_state=(atoi(value)>0)?TRUE:FALSE;
 		        }
 
+                else if(!strcmp(variable,"dump_retained_host_service_states_to_neb")){
+
+                        if(strlen(value)!=1||value[0]<'0'||value[0]>'1'){
+                                dummy=asprintf(&error_message,"Illegal value for dump_retained_host_service_states_to_neb");
+                                error=TRUE;
+                                break;
+                                }
+
+                        dump_retained_host_service_states_to_neb=(atoi(value)>0)?TRUE:FALSE;
+                        }
+
 		else if(!strcmp(variable,"use_retained_scheduling_info")){
 
 			if(strlen(value)!=1||value[0]<'0'||value[0]>'1'){
diff --git a/base/icinga.c b/base/icinga.c
index ecb8f0e..ad37385 100644
--- a/base/icinga.c
+++ b/base/icinga.c
@@ -154,6 +154,7 @@ int             soft_state_dependencies=FALSE;
 int             retain_state_information=FALSE;
 int             retention_update_interval=DEFAULT_RETENTION_UPDATE_INTERVAL;
 int             use_retained_program_state=TRUE;
+int		dump_retained_host_service_states_to_neb=FALSE;
 int             use_retained_scheduling_info=FALSE;
 int             retention_scheduling_horizon=DEFAULT_RETENTION_SCHEDULING_HORIZON;
 unsigned long   modified_host_process_attributes=MODATTR_NONE;
diff --git a/base/utils.c b/base/utils.c
index b6b8484..2d6f2ca 100644
--- a/base/utils.c
+++ b/base/utils.c
@@ -159,6 +159,7 @@ extern int      soft_state_dependencies;
 extern int      retain_state_information;
 extern int      retention_update_interval;
 extern int      use_retained_program_state;
+extern int	dump_retained_host_service_states_to_neb;
 extern int      use_retained_scheduling_info;
 extern int      retention_scheduling_horizon;
 extern unsigned long modified_host_process_attributes;
@@ -4524,6 +4525,7 @@ int reset_variables(void){
 	retain_state_information=FALSE;
 	retention_update_interval=DEFAULT_RETENTION_UPDATE_INTERVAL;
 	use_retained_program_state=TRUE;
+	dump_retained_host_service_states_to_neb=FALSE;
 	use_retained_scheduling_info=FALSE;
 	retention_scheduling_horizon=DEFAULT_RETENTION_SCHEDULING_HORIZON;
 	modified_host_process_attributes=MODATTR_NONE;
diff --git a/sample-config/icinga.cfg.in b/sample-config/icinga.cfg.in
index f684e13..f3241fa 100644
--- a/sample-config/icinga.cfg.in
+++ b/sample-config/icinga.cfg.in
@@ -747,6 +747,18 @@ retention_update_interval=60
 use_retained_program_state=1
 
 
+# DUMP RETAINED HOST SERVICE STATES TO NEB
+# This setting determines wether or not Icinga will dump host
+# and service states based on the values saved in the retention
+# file to the neb modules. As Icinga IDOUtils keeps the host
+# and service state already over reload/restarts, this is
+# intentionally left disabled.
+# Note: Enabling this can cause large dumps to neb on large
+# scale systems and decrease performance.
+
+dump_retained_host_service_states_to_neb=0
+
+
 
 # USE RETAINED SCHEDULING INFO
 # This setting determines whether or not Icinga will retain
diff --git a/xdata/xrddefault.c b/xdata/xrddefault.c
index 575c624..6df6e6f 100644
--- a/xdata/xrddefault.c
+++ b/xdata/xrddefault.c
@@ -69,6 +69,7 @@ extern int            test_scheduling;
 extern int            use_large_installation_tweaks;
 
 extern int            use_retained_program_state;
+extern int	      dump_retained_host_service_states_to_neb;
 extern int            use_retained_scheduling_info;
 extern int            retention_scheduling_horizon;
 
@@ -815,8 +816,14 @@ int xrddefault_read_retention_file_information(char *retention_file, int overwri
 						temp_host->last_hard_state_change=temp_host->last_state_change;
 
 					/* update host status */
-					update_host_status(temp_host,FALSE);
-				        }
+					/* MF 2011-07-22: see #1742 - do not dump retained host state into
+					   neb modules, setting aggregated dumps to true. made a config option. */
+					if(dump_retained_host_service_states_to_neb==TRUE){
+						update_host_status(temp_host,FALSE);
+					} else {
+						update_host_status(temp_host,TRUE);
+					}			
+				}
 
 				/* reset vars */
 				was_flapping=FALSE;
@@ -887,8 +894,15 @@ int xrddefault_read_retention_file_information(char *retention_file, int overwri
 						temp_service->last_hard_state_change=temp_service->last_state_change;
 
 					/* update service status */
-					update_service_status(temp_service,FALSE);
-				        }
+                                        /* MF 2011-07-22: see #1742 - do not dump retained service state into
+                                           neb modules, setting aggregated dumps to true. made a config option. */
+                                        if(dump_retained_host_service_states_to_neb==TRUE){
+                                                update_service_status(temp_service,FALSE);
+                                        } else {
+                                                update_service_status(temp_service,TRUE);
+                                        }
+
+				}
 
 				/* reset vars */
 				was_flapping=FALSE;





More information about the icinga-checkins mailing list