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.
+Custom variables are made available as macros with the name "_HOST<name>"
+where <name> is the name of the custom variable.
+
### Service Macros
The following service macros are available in all commands that are executed for
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.
+Custom variables are made available as macros with the name "_SERVICE<name>"
+where <name> is the name of the custom variable.
+
### User Macros
The following service macros are available in all commands that are executed for
USEREMAIL | This is an alias for the `email` 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
The following macros are available in all commands:
}
}
+ if (macro.SubStr(0, 5) == "_HOST") {
+ Dictionary::Ptr custom = GetCustom();
+ *result = custom ? custom->Get(macro.SubStr(5)) : "";
+ return true;
+ }
+
Dictionary::Ptr macros = GetMacros();
String name = macro;
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();
if (macros && macros->Contains(macro)) {
}
}
+ if (macro.SubStr(0, 8) == "_SERVICE") {
+ Dictionary::Ptr custom = GetCustom();
+ *result = custom ? custom->Get(macro.SubStr(8)) : "";
+ return true;
+ }
+
Dictionary::Ptr macros = GetMacros();
if (macros && macros->Contains(macro)) {
} else if (macro == "USERDISPLAYNAME" || macro == "CONTACTALIAS") {
*result = GetDisplayName();
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 {
String tmacro;