Custom vars in notes_url

Hi all,

I’m not sure its by design or a bug, but it looks like IcingaWeb2 don’t do anything with custom variables in the notes_url.

We’ve have a dynamic host_url defined in a host template which we include in every object host, this is working fine and we see the notes_url in IcingaWeb2. The host template looks like this:

template Host "generic-host" {

    import                  "notify-default"

    max_check_attempts      = 4
    check_interval          = 240s
    retry_interval          = 60s

    notes_url                 = "https://XXXX.tld/$host.vars.customer_code$/$host.name$.md"
}

Only the $host.vars.customer_code$ will not be converted to the value as defined in the object host config. This should work, right? We are runnig IcingaWeb2 version: 2.9.3

2

This is propably a problem of order as the attribute is set in the template where the customer does not exist yet.

Anyway I typically recommend using the custom navigation of Icinga Web 2 instead of notes_url / action_url of Icinga 2 as it is more flexible.

You can define Host and Service actions when selecting your user and the navigation tab. There you can name it, share it to all or only specific users or groups, use placeholders and filters. Also a menu items with a two level structure are possible (which are not the solution here but a great option too).

Thanks for your reply! I think this is the issue indeed.

Cool feature, didn’t know this :slight_smile: Unfortunately the problem still exists when using “custom navigation”, only $host.name$ will be converted.

It uses the syntax of Icinga Web 2 (with some additional options for compatibility).

So it would be $host_name$ for the attribute name of a host object and $_service_foo$ for the custom variable foo of a service object.

In your case it should work with $_host_customer_code$.

2 Likes