Variable resolution / Templating Question

hey all, i want to achieve something like this = "example"
vars.query = "..." + + "..."

with icinga director. how is that possible? Currently everything i write into a customfield gets quoted.

Your Environment

  • Director version (System - About): 1.8.1
    Version used (icinga2 --version): 2.11.3
    Operating System and version: Debian GNU/Linux 10 (buster)
    Enabled features (icinga2 feature list): api checker command ido-pgsql influxdb mainlog notification
    Config validation (icinga2 daemon -C): (/)

Using $$ just in the textfield without additional + should work. Perhaps it will require the full scope like $$.

1 Like

But I want to concatenate this variable with text. That’s the reason for the +. For more details about that issue see References in custom-vars are not resolved · Issue #281 · Mikesch-mp/icingaweb2-module-grafana · GitHub and the two referenced icinga2 and icingaweb2 issues

if you are inside of a command you can use icinga dsl to concat variables.

var mystring1 = macro("$customvar1$");
var mystring2 = macro("$customvar2$");
return mystring2 = “…” + mystring1 + “…”;

How do i do it with director only? For me the examples look like config file solutions?

Screenshot 2022-02-25 at 13.30.21

ok, but this only applies to arguments passed to a command, right? But i need this feature as a separate variable to access the variable with the grafana plugin.

you could explain what you are trying to achieve so it’s easier for us to help you find a workaround. If others see the usefulness the probability of implementation is also much higher