Set variable in Hostobject instead in Service

Hi have written an own plugin under bash script witch need two arguments.
One is the ip address and the other is an http host.
The ip address I can get it from $address$ on the Host object.
But how can I set the http host in Host object for my script.
When I set the http_host in the the Service object it is running well but i need different http host for different Hosts.
Means I would like to put the “host.vars.ep_host” in the Host Object.
But when I use in the Host Object
vars.ep_host[“www.abc.com”] = {}
or
vars.ep_host = “www.abc.com
it doesn´t work :frowning:

Would be great if anybody has an idea :slight_smile:

Here are my Service:

apply Service “EP_Homepage” {
import “generic-service”
check_command = “check_local_ep_website”
host.vars.ep_host = “www.abc.com
assign where host.vars.host_group == “ep-dev-front”
}

That does not work in your service.

If you have set the address in your host

your service can resolve it with

vars.ep_host = host.vars.ep_host

1 Like

Hi Hendrik,

works fine for me, thx!
I could have come up with it myself :innocent:

1 Like

Thats nice!! :slight_smile:

Please mark it as solution :wink: