icingaicinga2

Icinga 2: variable in display_name?


Is it possible to pass a variable to display_name in Icinga2 configuration, e.g. for a service:

apply Service for (disk_name => config in host.vars.disks) to Host {
  import "generic-service"
  vars = vars + config
  display_name = "disk" //TODO: pass hdd name?
  check_command = "disk"
}

Solution

  • Yes.

    apply Service for (disk_name => config in host.vars.disks) to Host {
      import "generic-service"
      vars = vars + config
      display_name = disk_name
      check_command = "disk"
    }