Page 1 of 1

Massive Change with API

Posted: Fri Apr 09, 2021 5:01 am
by FCC_Nagios_Support
Hello.

I have a new hostgroup with a service.
I have a list of hosts in a plain text. This hosts exists and have a monitoring setup yet.
I would like to add the new hostgroup to that hosts which are in the list (plain text).
Can I do it with API?
Many Thanks
KR

Re: Massive Change with API

Posted: Fri Apr 09, 2021 1:40 pm
by dchurch
It's not currently possible to use an API call to update host group membership.

It's still possible to do this, but you'd need to create a new host group using the config/import route:

Code: Select all

curl -XPOST "http://127.0.0.1/nagiosxi/api/v1/config/import?apikey=0xDEADBEEF&pretty=1" -d '
define hostgroup {
     hostgroup_name    my-new-group
     alias             New Group
     members           host1,host2,host3
}'