From 18ed9976962e953d3b649df8006993c9c89293bc Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 11 Feb 2013 16:29:23 +0100 Subject: [PATCH] Implemented some more dynamic macros. --- lib/icinga/host.cpp | 1 + lib/icinga/service.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index b0df21bbe..9f8cb8cd6 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -423,6 +423,7 @@ Dictionary::Ptr Host::CalculateDynamicMacros(void) const Dictionary::Ptr macros = boost::make_shared(); macros->Set("HOSTNAME", GetName()); + macros->Set("HOSTALIAS", GetName()); macros->Set("HOSTDISPLAYNAME", GetDisplayName()); macros->Set("HOSTSTATE", "DERP"); diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index f80849475..bf712f971 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -284,5 +284,15 @@ Dictionary::Ptr Service::CalculateDynamicMacros(void) const macros->Set("SERVICEATTEMPT", GetCurrentCheckAttempt()); macros->Set("MAXSERVICEATTEMPT", GetMaxCheckAttempts()); + Dictionary::Ptr cr = GetLastCheckResult(); + + if (cr) { + macros->Set("SERVICEOUTPUT", cr->Get("output")); + macros->Set("SERVICEPERFDATA", cr->Get("performance_data_raw")); + } else { + macros->Set("SERVICEOUTPUT", ""); + macros->Set("SERVICEPERFDATA", ""); + } + return macros; } -- 2.40.0