API config host - how to configure hostgroup inheritance

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
hostgroupguy
Posts: 2
Joined: Fri Mar 21, 2025 8:44 am

API config host - how to configure hostgroup inheritance

Post by hostgroupguy »

I'm using Nagios XI API to configure my hosts. I'm able to do it successfully except for hostgroup inheritance.

The options for choosing hostgroup inheritance for host in the GUI are standard, null or +.
In my code I'm posting hostgroups like this:

Code: Select all

$hostgroup="+hostgroup1,hostgroup2"
curl -X POST "$ENDPOINT" -d "hostgroups=$hostgroups"
It seems that nagios deletes the + all together cause in the GUI option standard is selected?

Thanks for your help.
DoubleDoubleA
Posts: 286
Joined: Thu Feb 09, 2017 5:07 pm

Re: API config host - how to configure hostgroup inheritance

Post by DoubleDoubleA »

It might be that the + is being interpreted as a space due to url encoding.

try:

Code: Select all

$hostgroup="%2Bhostgroup1,hostgroup2"
hostgroupguy
Posts: 2
Joined: Fri Mar 21, 2025 8:44 am

Re: API config host - how to configure hostgroup inheritance

Post by hostgroupguy »

That was the case indeed.

Thank you!
Locked