Using custom host property in service template

Hi there,

as some web checks (basically HTTP / HTTPS) require vHost information which is not necessary identical to the host address, I added a new custom host property called “host_hostname”.
This appears as expected in the relevant hosts and can be maintained there.

For HTTP / HTTPS checks I am using service apply rules.
First I use “http_vhost” field in the existing external http command:

As next step I defined the service template for http, using http check command and trying to pass the custom host property into the vhost property:

Unfortunately this cannot be resolved, so the command is not using -H but only -I.

As soon as change this to $check_address$ everything is working as expected, but I want to achieve that other vhost addresses can be used than the one check_address.
I also tried to use just parts like $vars.host_hostname$ or only $host_hostname$, but nothing leads to success.

I guess its more a problem in front of the screen: so me, getting something wrong here?

Best and thanks a lot for your help and input,
Matthias

Hi Matthias,

i recently had the same question and solved this with an “Apply For” rule analoge to the tutorial in https://icinga.com/docs/icinga-director/latest/doc/15-Service-apply-for-example/. This is also useful when you have more than one vhost on the same host.

Best regards,
Guido

1 Like