I’m looking for a way to assign services from one host to another host in case the first host is down. I guess this need will involve “apply dependency” but I’m not sure about its implementation in this case considering the “apply service” will have to be adhered to it.
My recommendation in this situation is to treat Icinga in exactly the same way
as whatever is using the services which move from one host to another - assign
a virtual host in Icinga, which runs the service, and is associated with the
(presumably) floating address which the machines wanting to use that service
will connect to.
So, you end up with 3 machines in Icinga - the two “real” servers, and the
floating service which might be running on one machine or the other, but is
always associated with the IP address which I’m assuming you move between the
machines, and which other systems use to connect to that service, no matter
where it’s running.
If my assumption that you have a floating IP address which is used to access
this service is incorrect, please give more details about how other systems
which need to use this service continue to connect to it when it moves from
one machine to another.
The solution with the virtual host sounds good. I have successfully assigned an all-zeros IP address to this host in the past (about 3 years ago, i.e. on an older version of Director) and it worked.
I would bind to both hosts only the services which always run on both hosts
(so, for example, disk or network checks etc), and then bind the services
which can move between the machines, to the floating virtual host.
This means that Icinga is connecting to the same floating resource as the
clients which need to use that resource, and can report on connectivity
problems, service availability etc. This gives you an accurate idea of
whether clients wanting to use the floating resources will actually be able to.