[opsview-base] [469] Hosts and services in scheduled downtime will now not send out recovery emails (OP-1366)

4 views
Skip to first unread message

s...@opsview.com

unread,
Jul 10, 2014, 5:36:25 AM7/10/14
to opsview-...@googlegroups.com
Revision
469
Author
tvoon
Date
2014-07-10 10:36:25 +0100 (Thu, 10 Jul 2014)

Log Message

Hosts and services in scheduled downtime will now not send out recovery emails (OP-1366)

Modified Paths

Added Paths

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2014-06-30 13:22:17 UTC (rev 468)
+++ trunk/Makefile	2014-07-10 09:36:25 UTC (rev 469)
@@ -638,6 +638,7 @@
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_fix_plugin_output_timeout_message.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_cve_2014_1878.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_defunct_reload_workers.patch
+	cd ${NAGIOS} && patch -p1 < ../patches/nagios_downtimes_block_host_service_recoveries.patch
 	if [ $(KERNEL_NAME) = Linux ] ; then \
 		cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
 	elif [ $(KERNEL_NAME) = Darwin ] ; then \

Added: trunk/patches/nagios_downtimes_block_host_service_recoveries.patch
===================================================================
--- trunk/patches/nagios_downtimes_block_host_service_recoveries.patch	                        (rev 0)
+++ trunk/patches/nagios_downtimes_block_host_service_recoveries.patch	2014-07-10 09:36:25 UTC (rev 469)
@@ -0,0 +1,62 @@
+diff -ur nagios-4.0.20130912.original/base/notifications.c nagios-4.0.20130912/base/notifications.c
+--- nagios-4.0.20130912.original/base/notifications.c	2014-06-19 18:49:59.318867042 +0100
++++ nagios-4.0.20130912/base/notifications.c	2014-07-10 09:42:21.234236758 +0100
+@@ -571,6 +571,18 @@
+ 		return ERROR;
+ 		}
+ 
++	/* if this service is currently in a scheduled downtime period, don't send the notification */
++	if(svc->scheduled_downtime_depth > 0) {
++		log_debug_info(DEBUGL_NOTIFICATIONS, 1, "This service is currently in a scheduled downtime, so we won't send notifications.\n");
++		return ERROR;
++		}
++
++	/* if this host is currently in a scheduled downtime period, don't send the notification */
++	if(temp_host->scheduled_downtime_depth > 0) {
++		log_debug_info(DEBUGL_NOTIFICATIONS, 1, "The host this service is associated with is currently in a scheduled downtime, so we won't send notifications.\n");
++		return ERROR;
++		}
++
+ 	/***** RECOVERY NOTIFICATIONS ARE GOOD TO GO AT THIS POINT *****/
+ 	if(svc->current_state == STATE_OK)
+ 		return OK;
+@@ -596,18 +608,6 @@
+ 		}
+ 		}
+ 
+-	/* if this service is currently in a scheduled downtime period, don't send the notification */
+-	if(svc->scheduled_downtime_depth > 0) {
+-		log_debug_info(DEBUGL_NOTIFICATIONS, 1, "This service is currently in a scheduled downtime, so we won't send notifications.\n");
+-		return ERROR;
+-		}
+-
+-	/* if this host is currently in a scheduled downtime period, don't send the notification */
+-	if(temp_host->scheduled_downtime_depth > 0) {
+-		log_debug_info(DEBUGL_NOTIFICATIONS, 1, "The host this service is associated with is currently in a scheduled downtime, so we won't send notifications.\n");
+-		return ERROR;
+-		}
+-
+ 	return OK;
+ 	}
+ 
+@@ -1531,16 +1531,16 @@
+ 		return ERROR;
+ 		}
+ 
+-	/***** RECOVERY NOTIFICATIONS ARE GOOD TO GO AT THIS POINT *****/
+-	if(hst->current_state == HOST_UP)
+-		return OK;
+-
+ 	/* if this host is currently in a scheduled downtime period, don't send the notification */
+ 	if(hst->scheduled_downtime_depth > 0) {
+ 		log_debug_info(DEBUGL_NOTIFICATIONS, 1, "This host is currently in a scheduled downtime, so we won't send notifications.\n");
+ 		return ERROR;
+ 		}
+ 
++	/***** RECOVERY NOTIFICATIONS ARE GOOD TO GO AT THIS POINT *****/
++	if(hst->current_state == HOST_UP)
++		return OK;
++
+ 	/* check if we shouldn't renotify contacts about the host problem */
+ 	if(hst->no_more_notifications == TRUE) {
+ 		log_debug_info(DEBUGL_NOTIFICATIONS, 1, "We shouldn't re-notify contacts about this host problem.\n");

Reply all
Reply to author
Forward
0 new messages