Massive Change with API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Massive Change with API

Post 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
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Massive Change with API

Post 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
}'
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Locked