Icinga2 Service Wildcards

Good morning,

I was wondering if there is a Wildcard possible for services like in the apply rules.

Lets say you have a bunch of services on (Windows) hosts that all start with “Service”. Service1, Service2 etc. Now, a buch of Windows servers with a bunch of Services, different numbers of them.

Is it possible to check for Windows services like “All that start with Service” and alert if one of them is in a “not running” state?

1 Like

So do you want a Notification Apply Rule that checks for Service* and alerts if it’s in the critical state in Icinga?

No, the check itself. I want to have multiple services checked on hosts that all share a similar name, but can be a different number on different hosts. Like, Host A has 2 Services like that, Host B has 4 etc.

Host A
Service A
Service B

Host B
Service A
Service B
Service C

Now, how to define the check without refering to all of the services one by one?

You can have a look at what’s done for HTTP checks in the default configuration, maybe this helps:

Now, thats also a manual definition of URLs to check.

The Situation right now is:


vars.dsmcad = [ "TSM CAD t1", "TSM CAD t2", "TSM CAD t3" ]


apply Service "MAGS DSMCAD " for (cad in host.vars.dsmcad){
   import "generic-service"
   command_endpoint = host.vars.agent_endpoint
   check_command = "service-windows"
   vars.service_win_service = cad
   vars.grafana_graph_disable = true
   assign where host.vars.dsmcad

I’d like to see something like

   vars.service_win_service = "TSM CAD *"
1 Like

Ah, I think I now understand what you’re trying to do, I missed that you mean actual Windows system services, not just Icinga services. So you basically want to automatically create Icinga service objects for Windows system services.

Icinga itself can’t read the list of Windows services and then use it to dynamically create services. You’d have to feed it this information yourself, either in the config or using the API (might be Icinga 2 API or Director API).

Another option would be to have a single Icinga 2 service that checks all services that match a pattern. This has to be supported by the check command plugin in use, I don’t know off the top of my head if any do, but I think it’s quite possible that the new PowerShell plugins for Windows do. Maybe someone else can jump in here with more information.

1 Like