[icinga-checkins] icinga.org: icinga2/master: Fix: Set last state/ state type before executing service checks.

git at icinga.org git at icinga.org
Fri Mar 8 14:44:15 CET 2013


Module: icinga2
Branch: master
Commit: fb82b73bc9e0fd9f7e829c5155ee6f2ef2933908
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=fb82b73bc9e0fd9f7e829c5155ee6f2ef2933908

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Mar  8 14:43:48 2013 +0100

Fix: Set last state/state type before executing service checks.

---

 lib/icinga/service-check.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp
index 1b2c5e0..d20bf44 100644
--- a/lib/icinga/service-check.cpp
+++ b/lib/icinga/service-check.cpp
@@ -381,6 +381,8 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
 	bool hardChange = false;
 	bool recovery;
 
+	/* The BeginExecuteCheck function already sets the old state, but we need to do it again
+	 * in case this was a passive check result. */
 	SetLastState(old_state);
 	SetLastStateType(old_stateType);
 
@@ -587,6 +589,9 @@ void Service::BeginExecuteCheck(const function<void (void)>& callback)
 		}
 
 		m_CheckRunning = true;
+
+		SetLastState(GetState());
+		SetLastStateType(GetLastStateType());
 	}
 
 	/* keep track of scheduling info in case the check type doesn't provide its own information */





More information about the icinga-checkins mailing list