]> granicus.if.org Git - icinga2/commitdiff
Implemented some more dynamic macros.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 11 Feb 2013 15:29:23 +0000 (16:29 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 11 Feb 2013 15:29:23 +0000 (16:29 +0100)
lib/icinga/host.cpp
lib/icinga/service.cpp

index b0df21bbe4ce7720d3b3ac86b24546bdad6cc33e..9f8cb8cd649379131287c1d281d54e3c40944d0e 100644 (file)
@@ -423,6 +423,7 @@ Dictionary::Ptr Host::CalculateDynamicMacros(void) const
        Dictionary::Ptr macros = boost::make_shared<Dictionary>();
 
        macros->Set("HOSTNAME", GetName());
+       macros->Set("HOSTALIAS", GetName());
        macros->Set("HOSTDISPLAYNAME", GetDisplayName());
        macros->Set("HOSTSTATE", "DERP");
 
index f80849475a64449e835aa2376084277a9a545a85..bf712f9719dbac5401ec901753bcec0c64b4dccb 100644 (file)
@@ -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;
 }