From: Gunnar Beutner Date: Mon, 11 Feb 2013 15:29:23 +0000 (+0100) Subject: Implemented some more dynamic macros. X-Git-Tag: v0.0.2~446 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18ed9976962e953d3b649df8006993c9c89293bc;p=icinga2 Implemented some more dynamic macros. --- 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; }