[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: core: avoid writing objects. cache if set to /dev/null

git at icinga.org git at icinga.org
Sun Mar 10 20:27:46 CET 2013


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

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Sun Mar 10 19:55:49 2013 +0100

core: avoid writing objects.cache if set to /dev/null

refs #3819

---

 Changelog                   |    2 ++
 sample-config/icinga.cfg.in |    4 ++++
 xdata/xodtemplate.c         |    3 +++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Changelog b/Changelog
index 1869ccc..f5e1c03 100644
--- a/Changelog
+++ b/Changelog
@@ -24,6 +24,7 @@ ENHANCEMENTS
 * core: enhance illegal macro character processing performance (Andreas Ericsson) #3389 - MF
 * core: add the notification type by string to debug logs; set CUSTOM=8, STALKING=9 (Andreas Ericsson) #3818 - MF
 * core: skip writing status.dat if explicitely set to /dev/null (e.g. when using alternate data retrieval methods like IDOUtils) (Andreas Ericsson) #3819 - MF
+* core: avoid writing objects.cache if set to /dev/null (Andreas Ericsson) #3819 - MF
 
 * classic ui: Add "set_expire_ack_by_default" to cgi configuration #3476 - CF
 * classic ui: Add "send_ack_notifications" to cgi configuration (TheCry) #3467 - CF
@@ -87,6 +88,7 @@ CHANGES
 
 * icinga.cfg - enable_state_based_escalation_ranges=0 (disabled if not set) fix for #3441
 * icinga.cfg - set status_file=/dev/null to disable its creation #3819
+* icinga.cfg - set object_cache_file=/dev/null to disable its creation #3819
 
 * core: -v param can be used more than once #3510
 * core: 'Warning: Host ... has no service associated with it!' now happens only in icinga -vv icinga.cfg #3510
diff --git a/sample-config/icinga.cfg.in b/sample-config/icinga.cfg.in
index 8c7e116..188a514 100644
--- a/sample-config/icinga.cfg.in
+++ b/sample-config/icinga.cfg.in
@@ -71,6 +71,10 @@ cfg_dir=@sysconfdir@/modules
 # this cache file (rather than looking at the object config files
 # directly) in order to prevent inconsistencies that can occur
 # when the config files are modified after Icinga starts.
+# If you explicitely set it to /dev/null the core will skip writing
+# the objects cache file entirely.
+# Tip: Use that file to debug your configuration with fully resolved
+# objects like the core sees them.
 
 object_cache_file=@STATEDIR@/objects.cache
 
diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
index a21ddcb..69325a8 100644
--- a/xdata/xodtemplate.c
+++ b/xdata/xodtemplate.c
@@ -10489,6 +10489,9 @@ int xodtemplate_cache_objects(char *cache_file) {
 	time_t current_time = 0L;
 	void *ptr = NULL;
 
+	/* skip if set to /dev/null */
+	if (!cache_file || !strcmp(cache_file, "/dev/null"))
+		return OK;
 
 	time(&current_time);
 





More information about the icinga-checkins mailing list