[icinga-checkins] icinga.org: icinga-core/dev/core: * core: make first_notification_delay depend on the first !OK hard state change and don 't reset timer for new hard states which would replace it #1918

git at icinga.org git at icinga.org
Wed Nov 9 16:30:24 CET 2011


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

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Nov  9 13:08:54 2011 +0100

* core: make first_notification_delay depend on the first !OK hard state change and don't reset timer for new hard states which would replace it #1918

refs #1918
refs #2048

---

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

diff --git a/Changelog b/Changelog
index 1fd7141..ab5c1ff 100644
--- a/Changelog
+++ b/Changelog
@@ -38,6 +38,7 @@ FIXES
 * core: fix downtime and comments delete with wrong loop pointers causing segfaults #1979
 * core: fix $NOTIFICATIONRECIPIENTS$ macro contains all contacts assigned to host|service, not only notified contacts #2023
 * core: plug memory leak in downtimes comment add (Dorian Guillois) #1979
+* core: make first_notification_delay depend on the first !OK hard state change and don't reset timer for new hard states which would replace it (Rogerio F Cunha) #1918
 
 * classic ui: fix for Classic-UI displays bad timeperiods #1989
 
diff --git a/THANKS b/THANKS
index 0279b16..343b0d8 100644
--- a/THANKS
+++ b/THANKS
@@ -72,6 +72,7 @@ in various ways.  If we missed your name, let us know.
 * Jim Crilley
 * Joel Crisp
 * Jean-Eric Cuendet
+* Rogerio F Cunha
 * Ahmon Dancy
 * Rune Darrud
 * Jan David
diff --git a/base/notifications.c b/base/notifications.c
index e8d08b7..468770c 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -591,12 +591,8 @@ int check_service_notification_viability(service *svc, int type, int options) {
 		/* determine the time to use of the first problem point */
 		first_problem_time = svc->last_time_ok; /* not accurate, but its the earliest time we could use in the comparison */
 
-		if ((svc->last_time_warning < first_problem_time) && (svc->last_time_warning > svc->last_time_ok))
-			first_problem_time = svc->last_time_warning;
-		if ((svc->last_time_unknown < first_problem_time) && (svc->last_time_unknown > svc->last_time_ok))
-			first_problem_time = svc->last_time_unknown;
-		if ((svc->last_time_critical < first_problem_time) && (svc->last_time_critical > svc->last_time_ok))
-			first_problem_time = svc->last_time_critical;
+		if ((svc->last_hard_state_change > svc->last_time_ok))
+			first_problem_time = svc->last_hard_state_change;
 
 		if (current_time < (time_t)((first_problem_time == (time_t)0L) ? program_start : first_problem_time) + (time_t)(svc->first_notification_delay * interval_length)) {
 			log_debug_info(DEBUGL_NOTIFICATIONS, 1, "Not enough time has elapsed since the service changed to a non-OK state, so we should not notify about this problem yet\n");
@@ -1719,10 +1715,8 @@ int check_host_notification_viability(host *hst, int type, int options) {
 		/* determine the time to use of the first problem point */
 		first_problem_time = hst->last_time_up; /* not accurate, but its the earliest time we could use in the comparison */
 
-		if ((hst->last_time_down < first_problem_time) && (hst->last_time_down > hst->last_time_up))
-			first_problem_time = hst->last_time_down;
-		if ((hst->last_time_unreachable < first_problem_time) && (hst->last_time_unreachable > hst->last_time_unreachable))
-			first_problem_time = hst->last_time_unreachable;
+		if ((hst->last_hard_state_change > hst->last_time_up))
+			first_problem_time = hst->last_hard_state_change;
 
 		if (current_time < (time_t)((first_problem_time == (time_t)0L) ? program_start : first_problem_time) + (time_t)(hst->first_notification_delay * interval_length)) {
 			log_debug_info(DEBUGL_NOTIFICATIONS, 1, "Not enough time has elapsed since the host changed to a non-UP state (or since program start), so we shouldn't notify about this problem yet.\n");





More information about the icinga-checkins mailing list