mirror of
https://github.com/Icinga/icinga2.git
synced 2025-06-05 14:20:17 +02:00
parent
21fb0d9872
commit
3a10127bf4
@ -106,6 +106,9 @@ hosts or services:
|
|||||||
HOSTADDRESS | This is an alias for the `address` macro. If the `address` macro is not defined the host object's name is used instead.
|
HOSTADDRESS | This is an alias for the `address` macro. If the `address` macro is not defined the host object's name is used instead.
|
||||||
HOSTADDRESS6 | This is an alias for the `address6` macro. If the `address` macro is not defined the host object's name is used instead.
|
HOSTADDRESS6 | This is an alias for the `address6` macro. If the `address` macro is not defined the host object's name is used instead.
|
||||||
|
|
||||||
|
Custom variables are made available as macros with the name "_HOST<name>"
|
||||||
|
where <name> is the name of the custom variable.
|
||||||
|
|
||||||
### Service Macros
|
### Service Macros
|
||||||
|
|
||||||
The following service macros are available in all commands that are executed for
|
The following service macros are available in all commands that are executed for
|
||||||
@ -137,6 +140,9 @@ services:
|
|||||||
TOTALHOSTSERVICESUNKNOWN | Number of services associated with the host which are in an `UNKNOWN` state.
|
TOTALHOSTSERVICESUNKNOWN | Number of services associated with the host which are in an `UNKNOWN` state.
|
||||||
TOTALHOSTSERVICESCRITICAL | Number of services associated with the host which are in a `CRITICAL` state.
|
TOTALHOSTSERVICESCRITICAL | Number of services associated with the host which are in a `CRITICAL` state.
|
||||||
|
|
||||||
|
Custom variables are made available as macros with the name "_SERVICE<name>"
|
||||||
|
where <name> is the name of the custom variable.
|
||||||
|
|
||||||
### User Macros
|
### User Macros
|
||||||
|
|
||||||
The following service macros are available in all commands that are executed for
|
The following service macros are available in all commands that are executed for
|
||||||
@ -149,6 +155,14 @@ users:
|
|||||||
USEREMAIL | This is an alias for the `email` macro.
|
USEREMAIL | This is an alias for the `email` macro.
|
||||||
USERPAGER | This is an alias for the `pager` macro.
|
USERPAGER | This is an alias for the `pager` macro.
|
||||||
|
|
||||||
|
Custom variables are made available as macros with the name "_USER<name>" and
|
||||||
|
"_CONTACT<name>" where <name> is the name of the custom variable.
|
||||||
|
|
||||||
|
### Notification Macros
|
||||||
|
|
||||||
|
Custom variables are made available as macros with the name "_NOTIFICATION<name>"
|
||||||
|
where <name> is the name of the custom variable.
|
||||||
|
|
||||||
### Global Macros
|
### Global Macros
|
||||||
|
|
||||||
The following macros are available in all commands:
|
The following macros are available in all commands:
|
||||||
|
@ -615,6 +615,12 @@ bool Host::ResolveMacro(const String& macro, const CheckResult::Ptr&, String *re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (macro.SubStr(0, 5) == "_HOST") {
|
||||||
|
Dictionary::Ptr custom = GetCustom();
|
||||||
|
*result = custom ? custom->Get(macro.SubStr(5)) : "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary::Ptr macros = GetMacros();
|
Dictionary::Ptr macros = GetMacros();
|
||||||
|
|
||||||
String name = macro;
|
String name = macro;
|
||||||
|
@ -325,6 +325,12 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User::
|
|||||||
|
|
||||||
bool Notification::ResolveMacro(const String& macro, const CheckResult::Ptr&, String *result) const
|
bool Notification::ResolveMacro(const String& macro, const CheckResult::Ptr&, String *result) const
|
||||||
{
|
{
|
||||||
|
if (macro.SubStr(0, 13) == "_NOTIFICATION") {
|
||||||
|
Dictionary::Ptr custom = GetCustom();
|
||||||
|
*result = custom ? custom->Get(macro.SubStr(13)) : "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary::Ptr macros = GetMacros();
|
Dictionary::Ptr macros = GetMacros();
|
||||||
|
|
||||||
if (macros && macros->Contains(macro)) {
|
if (macros && macros->Contains(macro)) {
|
||||||
|
@ -474,6 +474,12 @@ bool Service::ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (macro.SubStr(0, 8) == "_SERVICE") {
|
||||||
|
Dictionary::Ptr custom = GetCustom();
|
||||||
|
*result = custom ? custom->Get(macro.SubStr(8)) : "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary::Ptr macros = GetMacros();
|
Dictionary::Ptr macros = GetMacros();
|
||||||
|
|
||||||
if (macros && macros->Contains(macro)) {
|
if (macros && macros->Contains(macro)) {
|
||||||
|
@ -74,6 +74,14 @@ bool User::ResolveMacro(const String& macro, const CheckResult::Ptr&, String *re
|
|||||||
} else if (macro == "USERDISPLAYNAME" || macro == "CONTACTALIAS") {
|
} else if (macro == "USERDISPLAYNAME" || macro == "CONTACTALIAS") {
|
||||||
*result = GetDisplayName();
|
*result = GetDisplayName();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (macro.SubStr(0, 5) == "_USER") {
|
||||||
|
Dictionary::Ptr custom = GetCustom();
|
||||||
|
*result = custom ? custom->Get(macro.SubStr(5)) : "";
|
||||||
|
return true;
|
||||||
|
} else if (macro.SubStr(0, 8) == "_CONTACT") {
|
||||||
|
Dictionary::Ptr custom = GetCustom();
|
||||||
|
*result = custom ? custom->Get(macro.SubStr(8)) : "";
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
String tmacro;
|
String tmacro;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user