Create hostgroup via rest API

Hi there,

I am wondering if it is possible to create a hostgroup in Icinga Director with the “assign where” field filled in.

I’ve been able to create host groups fin, but I am not sure what the POST request should contain for that particular field.

We are attempting to dynamically create host groups populated by zone or another custom attribute, and we want to ensure when someone in our organisation creates a new zone, a new host group is created.


An apply_rule creation will not create the associated hostgroup, and there is a possibility that the POST call will fail on validation of the call.
You will need to create the host group specifically prior to creating the apply_rule. If you are creating the group just to have a 1 group per zone, you do not need to do that, as you can state in the apply_rule ’ assign where == “zone name” ’


1 Like

Thanks for the reply - to clarify, I’ve been able to create host groups fine with the API - I just haven’t been able to set the “assign where” field in Director - I presume that isn’t possible through the Director API.

That’s how we’ve created our existing zone based groups - e.g. assign where == “” - but creating these manually is what we want to avoid.