[icinga-checkins] icinga.org: icinga-core/mbecker/test: move eventprofiler init after config parsing, checking if enabled, making it optional all over #572 #702

git at icinga.org git at icinga.org
Fri Sep 24 19:37:25 CEST 2010


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

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Fri Sep 24 18:38:26 2010 +0200

move eventprofiler init after config parsing, checking if enabled, making it optional all over #572 #702

refs #572
refs #702
refs #312

---

 Changelog          |    1 +
 base/icinga.c      |   12 +++++++-----
 base/icingastats.c |   45 ++++++++++++++++++++++-----------------------
 3 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/Changelog b/Changelog
index 8cafbeb..7767514 100644
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,7 @@ FIXES
 * core: fix format errors for logging eventhandlers (Guillaume Rousse) #779
 * core: remove program update checks as scheduled timed events, not written to status/retention.dat anymore #790
 * core: don't skip hostchecks when servicechecks are disabled (Stephen Gran) #778
+* core: move eventprofiler init after config parsing, checking if enabled, making it optional all over #572 #702
 
 * classic ui: update jquery for multiple cmds dropdown, resolve conflicts with pnp #807
 * classic ui: moved individual document_header and document_footer to cgiutils.c, distinction by cgi_id #808
diff --git a/base/icinga.c b/base/icinga.c
index 6704d26..533c33f 100644
--- a/base/icinga.c
+++ b/base/icinga.c
@@ -395,11 +395,6 @@ int main(int argc, char **argv, char **env){
 	mtrace();
 #endif
 
-/* make sure gcc3 won't hit here */
-#ifndef GCCTOOOLD
-	profiler_init();
-#endif
-
 	if(daemon_mode==FALSE){
 		printf("\n%s %s\n", PROGRAM_NAME ,PROGRAM_VERSION);
 		printf("Copyright (c) 2009-2010 Icinga Development Team (http://www.icinga.org)\n");
@@ -655,6 +650,13 @@ int main(int argc, char **argv, char **env){
 	/* else start to monitor things... */
 	else{
 
+/* make sure gcc3 won't hit here */
+#ifndef GCCTOOOLD
+	/* This is Sparta! */
+	if(event_profiling_enabled==TRUE)
+	        profiler_init();
+#endif
+
 		/* keep monitoring things until we get a shutdown command */
 		do{
 
diff --git a/base/icingastats.c b/base/icingastats.c
index e5f9ffd..3ce0765 100644
--- a/base/icingastats.c
+++ b/base/icingastats.c
@@ -410,29 +410,28 @@ int main(int argc, char **argv){
 /* make sure gcc3 won't hit here */
 #ifndef GCCTOOOLD
 		/* event profiler */
-
-		/* read main config file */
-        	result=read_config_file();
-        	if(result==ERROR && mrtg_mode==FALSE)
-        	{
-            		printf("Error processing config file '%s'\n",main_config_file);
-            		return ERROR;
-        	}
-
-        	/* read the status file */
-        	result=read_status_file();
-        	if(result==ERROR && mrtg_mode==FALSE)
-        	{
-            		printf("Error reading status file '%s'\n",status_file);
-            		return ERROR;
-        	}
-
-        	p = profiled_data;
-        	while(p)
-        	{
-            		printf("PROFILE_(COUNTER/ELAPSED/EVENTPS)_%s\t\tdynamically generated profile data.\n",p->name);
-            		p = p->next;
-        	}
+	        if(event_profiling_enabled==TRUE){
+
+			/* read main config file */
+	        	result=read_config_file();
+	        	if(result==ERROR && mrtg_mode==FALSE){
+	            		printf("Error processing config file '%s'\n",main_config_file);
+        	    		return ERROR;
+        		}
+
+	        	/* read the status file */
+	        	result=read_status_file();
+	        	if(result==ERROR && mrtg_mode==FALSE){
+	            		printf("Error reading status file '%s'\n",status_file);
+	            		return ERROR;
+	        	}
+
+	        	p = profiled_data;
+	        	while(p){
+	            		printf("PROFILE_(COUNTER/ELAPSED/EVENTPS)_%s\t\tdynamically generated profile data.\n",p->name);
+	            		p = p->next;
+	        	}
+		}
 #endif
 		printf("\n");
 		printf(" Note: Replace x's in MRTG variable names with 'MIN', 'MAX', 'AVG', or the\n");





More information about the icinga-checkins mailing list