Implemented some more dynamic macros.

This commit is contained in:
Gunnar Beutner 2013-02-11 16:29:23 +01:00
parent 07acb1c553
commit 18ed997696
2 changed files with 11 additions and 0 deletions

View 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");

View 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;
}