How to automatically create services based on host group?


First, I’m sorry for the very generic title of this new topic. I didn’t really find a good one for my question.

Here is my situation:
I’m using physical servers from a Cloud provider. This Cloud provider push public metrics from these servers, like the processor/motherboard/room… temperatures

On my Icinga2 configuration, each physical server is declared as a Host object. Pretty basic :slight_smile:
On each host, I’ve created a special service that checks these metrics. It works perfectly and I’m getting alert when the temperature is too hot.


Sometimes, the API I call to retrieve the metrics is down. As I’m not the maintainer of this API, I can’t do anything. So, when it happens, I receive a ton of notification because all of the checks are unknown.

My idea:
I’d create one host, that is the metrics API itself. I’d apply a simple check_http on it.
On this host, automatically create one service for each Host object (with the flag “physicalServer” = true).
Each service will check the temperature of one physical server.
By doing that, if the metrics API is down, I’ll receive only one notification, not a ton from all of the check temperature service.

Is that possible?

Thanks for reading,


the topic title is a bit misleading, I read your question as “prevent notifications from unreachable services”. You can do so with Dependencies where you create one health check for your API, and let the other checks depend on it. Check the docs for it.

Simplified example, can be refactored into more generic handling later.

apply Dependency "api-health" to Service {
  parent_host_name = "api-host"
  parent_service_name = "api-health"

  disable_notifications = true

  assign where == "api-host" && != "api-health"


Wow, I just didn’t think at all about dependency. Today, I don’t use this feature (except the default one between host and its services of course).

I’ll take a look at the documentation. I’ll tag your reply “as solution” as soon as it will works.

Thanks a lot for your (very very fast :)) help

1 Like

It was really hard to found the correct configuration, but finally it works and your suggestion do the job :slight_smile:
Thanks again!