[icinga-checkins] icinga.org: icinga2/next: Fix macros requiring last check result.

git at icinga.org git at icinga.org
Mon Nov 4 09:30:25 CET 2013


Module: icinga2
Branch: next
Commit: 6eae4508aa85867869dd48abc0804f0f6464a3e8
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=6eae4508aa85867869dd48abc0804f0f6464a3e8

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon Nov  4 09:28:23 2013 +0100

Fix macros requiring last check result.

Fixes #4981

---

 lib/icinga/pluginchecktask.cpp |    4 ++--
 lib/icinga/plugineventtask.cpp |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/icinga/pluginchecktask.cpp b/lib/icinga/pluginchecktask.cpp
index 1df4a3a..dbb2241 100644
--- a/lib/icinga/pluginchecktask.cpp
+++ b/lib/icinga/pluginchecktask.cpp
@@ -46,7 +46,7 @@ Dictionary::Ptr PluginCheckTask::ScriptFunc(const Service::Ptr& service)
 	resolvers.push_back(commandObj);
 	resolvers.push_back(IcingaApplication::GetInstance());
 
-	Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, Dictionary::Ptr(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
+	Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, service->GetLastCheckResult(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
 
 	Dictionary::Ptr envMacros = boost::make_shared<Dictionary>();
 
@@ -56,7 +56,7 @@ Dictionary::Ptr PluginCheckTask::ScriptFunc(const Service::Ptr& service)
 		BOOST_FOREACH(const String& macro, export_macros) {
 			String value;
 
-			if (!MacroProcessor::ResolveMacro(macro, resolvers, Dictionary::Ptr(), &value)) {
+			if (!MacroProcessor::ResolveMacro(macro, resolvers, service->GetLastCheckResult(), &value)) {
 				Log(LogWarning, "icinga", "export_macros for service '" + service->GetName() + "' refers to unknown macro '" + macro + "'");
 				continue;
 			}
diff --git a/lib/icinga/plugineventtask.cpp b/lib/icinga/plugineventtask.cpp
index 313463c..611c2ea 100644
--- a/lib/icinga/plugineventtask.cpp
+++ b/lib/icinga/plugineventtask.cpp
@@ -44,7 +44,7 @@ void PluginEventTask::ScriptFunc(const Service::Ptr& service)
 	resolvers.push_back(commandObj);
 	resolvers.push_back(IcingaApplication::GetInstance());
 
-	Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, Dictionary::Ptr(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
+	Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, service->GetLastCheckResult(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
 
 	Dictionary::Ptr envMacros = boost::make_shared<Dictionary>();
 
@@ -54,7 +54,7 @@ void PluginEventTask::ScriptFunc(const Service::Ptr& service)
 		BOOST_FOREACH(const String& macro, export_macros) {
 			String value;
 
-			if (!MacroProcessor::ResolveMacro(macro, resolvers, Dictionary::Ptr(), &value)) {
+			if (!MacroProcessor::ResolveMacro(macro, resolvers, service->GetLastCheckResult(), &value)) {
 				Log(LogWarning, "icinga", "export_macros for command '" + commandObj->GetName() + "' refers to unknown macro '" + macro + "'");
 				continue;
 			}





More information about the icinga-checkins mailing list