Hi Tobias,

On 09.09.2017 15:49, Tobias Köck wrote:
> I am wondering what is the difference between a macro access with
> 
> ... = $host.variable$

This is a simple way to let the user include macros in most of the
variables, so the are evaluated dynamically on check execution etc.

> and
> 
> ... = macro($host.variable$)?

As of your example in the other mails of this thread, the example is
used inside {{ }}, a custom function.

Now this custom function is evaluated when the variable is retrieved,
and the macro() functions helps you to get the values "when you need them".

Summary:

vars.something = "$host.name$"
// is evaluated when Icinga needs it

vars.something = {{
  var name = macro("$host.name$")
  return name + ".example.com"
}}
// Helps you with custom implementations

An example:
https://www.icinga.com/docs/icinga2/latest/doc/08-advanced-topics/#access-object-attributes-at-runtime


Regards
Markus Frosch
-- 
Icinga Open Source Monitoring
https://www.icinga.com
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to