notification inheritance

Gordon Messmer yinyang at eburg.com
Mon May 24 18:40:22 CEST 2010


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

In my nagios configuration, I have a number of services which are 
applied to hostgroups.  Rather than inheriting any notification period, 
each service has a "NULL" notification period which is treated as a 
'24x7' period.  With the attached patch, nagios will check for a NULL 
period and use the period from the associated host as the documentation 
states will happen.

I have no idea whether or not similar issues exist with the other 
implied inheritance values.


1: http://nagios.sourceforge.net/docs/3_0/objectinheritance.html
-------------- next part --------------
--- nagios-3.2.1/base/notifications.c.orig	2010-05-22 20:57:25.030003549 -0700
+++ nagios-3.2.1/base/notifications.c	2010-05-22 21:50:30.397253749 -0700
@@ -294,6 +294,7 @@
 /* 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;
 	
@@ -324,8 +325,14 @@
 		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 = svc->host_ptr->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");
 
-------------- next part --------------
------------------------------------------------------------------------------

-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list