Adding Existing Hosts to Existing Host Groups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mananatmacys
Posts: 7
Joined: Wed Jun 19, 2019 2:14 pm

Adding Existing Hosts to Existing Host Groups

Post by mananatmacys »

How can I use the API to add existing hosts to existing host groups?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Adding Existing Hosts to Existing Host Groups

Post by benjaminsmith »

Hello,

Modifying the hostgroup using the REST API will re-write the members list. For example, to add host1 and host2 to the test-group, the command would be as follows:

Code: Select all

curl -XPUT "http://<ip-address>/nagiosxi/api/v1/config/hostgroup/test-group?apikey=<your api key>&pretty=1&members=host1,host2&applyconfig=1"
You'll find sample commands for your server in Help > API Docs > Config Reference.

Let me know if you have any questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked