I’m used to declare some services in this way:
object Host "foo.bar.baz" {
[...]
vars.bar["My Beautiful Service"] = {
[...]
}
}
apply Service "Foo " for (name => config in host.vars.bar) {
[...]
}
This works and creates a service named Foo My Beautiful Service.
If I want the service to be named as My Beautiful Service Foo Then I tried to create the same service with this apply rule:
apply Service for (name => config in host.vars.bar) " Foo " {
[...]
}
But this not works:
[2020-01-23 18:37:21 +0000] critical/config: Error: syntax error, unexpected T_STRING, expecting '{'
Location: in /etc/icinga2/services.d/custom-services.conf: 1:57-1:66
/etc/icinga2/services.d/custom-services.conf(1): apply Service for (name => config in host.vars.bar) " Foo" {
^^^^^^^^^^
/etc/icinga2/services.d/custom-services.conf(2): import "generic-service"
/etc/icinga2/services.d/custom-services.conf(3):
[2020-01-23 18:37:21 +0000] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.
Is there a way to do what I want?
Thank you very much!