Work with Director Service Sets through API

Hello everyone,
I’m trying to create and manage ServiceSets in Icinga Director through Director API,
Unfortunately not all functions are documented and i need to make some extra research to find how i can work with each part of Director interface through API requests.

Currently i’m looking how to:
1. GET a list of all ServiceSets configured in Icinga2 Director

Example that works good for querying single ServiceSet:
curl -u awesomeuser:awesomepassword GET -H 'Accept: application/json' "

    "assign_filter": "host.groups=%22random%22",
    "description": "Set of random checks for benchmarking",
    "object_name": "positive_checks",
    "object_type": "template"

The same try with bulk request:
curl -u awesomeuser:awesomepassword GET -H 'Accept: application/json' "

{"status":"error","message":"Page not found."}

Currently services endpoint works in both bulk and single object query:
/icingaweb2/director/service?name=something vs /icingaweb2/director/services for bulk requests

I expected to get a bulk reply as it works with services

I’ve checked URL in Web UI, it points at /icingaweb2/director/services/sets but
curl -u awesomeuser:awesomepassword GET -H 'Accept: application/json' "
Doesn’t provide any output at all

2. GET a list of services in specified ServiceSet
/icingaweb2/director/serviceset/services?name=positive_checks in Web UI points me to the list of services:

Unfortunately i’m not able to make the same call through API

3. Add/Remove service to/from ServiceSet
Also need help with those requests

Any advice is highly appreciated.

With best regards,

Hello there!

I’m just checking in, because I saw that your topic wasn’t answered yet…
Did you made any progress in the past two weeks?
Do you still need help?

Have a nice day,

Hello Feu,

Unfortunetly have no progress,
I was only able to find a workaround using Icinga2 baskets, but it doesn’t resolve question with Director API it self.

I suppose that it doesn’t implemented in Director API, it would be wondeful if i can get reply from Icinga team on this, maybe it’s possible to make a feature request if those functions not implemented yet.

With best regards,

Hello there!
I asked around a little and what I gathered was the following, I quote:

There are no service sets via API.
Background for that is, that we have never defined what the filters necessary for assigns should look like. Because the current syntax with url encoded Icinga Web filters seemed a little too limiting.
That’s why everything to do with filters has originally not been included in the API.
Some users managed to get it done anyway though, so we can’t really change it up without compatibility issues.
In this case: feel free to open a feature request on GitHub :slight_smile:

I hope this helps,

1 Like