Hi
I’m not sure if my intention is unusual, but I couldn’t find an answer to my question in the documentation and thought maybe I can find an answer here. I have a host and a service:
object Host "example.com" {
import "generic-host"
}
object Service "service01" {
import "generic-service"
host_name = "example.com"
display_name = "service01"
check_command = "command01"
vars.key01 = 500
}
This works so far, the host and the service are available in Icinga. Now I would like to use “assign where” to create a second service. The second service should be created for each host if:
- The host has a service with name “service01”
- The corresponding “service01” has the variable “key01”
I was thinking something like that:
apply Service "service02" {
import "generic-service"
display_name = "service02"
check_command = "command02"
assign where "service01" in host.services
}
But this ends with:
[2023-11-10 16:19:08 +0100] critical/config: Error: Invalid field access (for value of type 'Host'): 'services'
And that doesn’t take into account the fact that I also want to check the variable.
Best,
Markus