mirror of https://github.com/Icinga/icinga2.git
Implemented some more dynamic macros.
This commit is contained in:
parent
07acb1c553
commit
18ed997696
|
@ -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");
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue