[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: fix notification_period inheritance for services (Gordon Messmer)

git at icinga.org git at icinga.org
Tue May 25 11:06:32 CEST 2010


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

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Tue May 25 11:06:25 2010 +0200

fix notification_period inheritance for services (Gordon Messmer)

The documentation for object inheritance indicates that where a
notification_period is not available for a service, the
notification_period from the associated host will be implicitly
inherited.

Right now, rather than inheriting any notification period,
each service has a "NULL" notification period which is treated
as a '24x7' period.  Now, Icinga will check for a NULL period
and use the period from the associated host as the documentation
states will happen.

fixes #456

---

 Changelog            |    1 +
 THANKS               |    1 +
 base/notifications.c |    9 ++++++++-
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Changelog b/Changelog
index 5ea8e88..3ebc349 100644
--- a/Changelog
+++ b/Changelog
@@ -63,6 +63,7 @@ FIXES
 * core: xdata/xpddefault.c: Close perfdata files if fd's are >= 0 (Andreas Ericsson)
 * core: fix xpddefault_{host,service}_perfdata_file_pipe not set properly on configuration re-read
 * core: fix SIGSEGV in checks.c on Solaris (Torsten Huebler)
+* core: fix notification_period inheritance for services (Gordon Messmer)
 
 * cgi: minor cleanups to cgiutils.c (Eric Sesterhenn)
 * cgi: fix cmd.cgi incomplete output for command description
diff --git a/THANKS b/THANKS
index 05a9b1d..519df62 100644
--- a/THANKS
+++ b/THANKS
@@ -176,6 +176,7 @@ in various ways.  If we missed your name, let us know.
 * Emanuel Massano
 * Richard Mayhew
 * Mike McHenry
+* Gordon Messmer
 * Lars Michelson
 * Martin Mielke
 * Christian Mies
diff --git a/base/notifications.c b/base/notifications.c
index 8cda11a..74800ef 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -326,6 +326,7 @@ int service_notification(service *svc, int type, char *not_author, char *not_dat
 /* checks the viability of sending out a service alert (top level filters) */
 int check_service_notification_viability(service *svc, int type, int options){
 	host *temp_host;
+	timeperiod *temp_period;
 	time_t current_time;
 	time_t timeperiod_start;
 	
@@ -356,8 +357,14 @@ int check_service_notification_viability(service *svc, int type, int options){
 		return ERROR;
 	        }
 
+	/* if the service has no notification period, inherit one from the host */
+	temp_period = svc->notification_period_ptr;
+	if(temp_period == NULL){
+		temp_period = temp_host->notification_period_ptr;
+	}
+
 	/* see if the service can have notifications sent out at this time */
-	if(check_time_against_period(current_time,svc->notification_period_ptr)==ERROR){
+	if(check_time_against_period(current_time,temp_period)==ERROR){
 
 		log_debug_info(DEBUGL_NOTIFICATIONS,1,"This service shouldn't have notifications sent out at this time.\n");
 





More information about the icinga-checkins mailing list