Apply Serivce multiple times depending on a dict/array?

Hello Icinga community,

using icinga2 and the icinga director, i am trying to solve the following:
Assuming i have a windows host, and all drives that this hosts has attached, like C:, D: and so on, are stored in a a host variable array “windows_disks”.
Would i be possible to create a service that loops over this array and checks each drive it finds in the “windows_disks” array as an own check? i know i could just check all drive with one check, but it woould be nice to have them separated and i dont want to create and apply a own single check for each drive that a host might have.
So essentialy: loop over a array and display an own check for each element in the array

Thanks already

Killerloop

Hi, yes it is possible. It is described here Fields Example Interfaces Array - Icinga Director (as example create an array with Interfaces to check) and this Service Apply For Example - Icinga Director (apply for rule with ports as example)

Thanks a lot, exactly what i was looking for.
If someone else stumbles over this thread, here’s a nice little video that explains how to do it:

Regards

Killerloop

1 Like

Hey there :slight_smile:
I would like to ask you to mark an answer as the solution, if it resolves your topic.