Set boolean/datalist service-fields based on host boolean/datalist fields

I usually come up with the solution on my own when I’m in the process of writing a new post in the Icinga forums. But this time I’m really stuck. So, I’m faced with an old problem again; I am very dissatisfied with my previous solution:

There is a variable per host that I would like to transfer to fields of some services (within the service set). This usually works great with $host.vars.some_var$, but unfortunately not with Booleans or DataLists.

Specifically, it’s about the no_ssl variable in the NRPE command. I would like to set this per host and not per service because the setting within the host does not change. With the Icinga DSL that’s no problem at all, but how does it work in the Icinga Director???

I just fail at the drop down menu for Booleans/Datalists.

I don’t even know what exactly to google for, have now spent 3 hours searching the director github issues as well as this Icinga forum. Tried “dynamic boolean”, “variable boolan”, “host variable in datalist” and “host variable in service dropdown”. My previous solution uses two service sets with identical services: one with no_ssl=true per service and one with no_ssl=false. However, I am reaching my administrative limits with this.

I don’t want to trigger a discussion about NRPE or even a no_ssl NRPE - I’m aware of the consequences.

Give as much information as you can, e.g.

  • Director version (System - About): 1.10.2
  • Icinga Web 2 version and modules (System - About): 2.11.4
  • Icinga 2 version (icinga2 --version): r2.13.6
  • Operating System and version: Linux/Debian:11

Push DSL down into check command parameters?

Hi :slight_smile:
Looking at the default nrpe command from the ITL it implements the parameter like this

"-n" = {
            description = "Do not use SSL"
            set_if = "$nrpe_no_ssl$"
        }

My first try would be to change the set_if variable to your host variable.
That way you can set no_ssl_var to true/false on you host and set the check parameter accordingly.

Please excuse my late response. Thank you for your answers. I have now looked at using the Icinga DSL at the command parameter level. That’s probably what it comes down to. I would still wish Icinga’s DSL could also be used at the service level.

1 Like