Hi,
I have added few hosts in Nagiosxi and I have added hostgroups in the host definitions instead of adding them as a member in hostgroup definition. I now want to add another hostgroup to one of the hosts keeping its already added hostgroups intact.
I know I can do it from UI using manage hostgroups but can someone help me if there is a way to do it using command line? May be using REST API or Database query? I need it to put in a script.
I am OK to delete the hosts and recreate but I first need the list of already existing hostgroups in that host definition before deleting and recreating.
I have tried following REST API but it doesn't give hostgroups list in the output.
http://NagiosHost/nagiosxi/api/v1/objec ... v&pretty=1
Thanks for your help in advance.
Adding a hostgroup to a host definition using REST API
Re: Adding a hostgroup to a host definition using REST API
I suppose you should be using object/hostgroup part of API instead..
this should list all your host groups.
http://nagioshost/nagiosxi/api/v1/objec ... v&pretty=1
this should list all your host groups.
http://nagioshost/nagiosxi/api/v1/objec ... v&pretty=1
- tacolover101
- Posts: 432
- Joined: Mon Apr 10, 2017 11:55 am
Re: Adding a hostgroup to a host definition using REST API
check out this doc which you might find handy -
You do not have the required permissions to view the files attached to this post.
Re: Adding a hostgroup to a host definition using REST API
Thanks for the input, folks! @ddaluka let us know if you have further questions.
Former Nagios employee
Re: Adding a hostgroup to a host definition using REST API
Hi All,
Thank you for your inputs. I have now managed to get this information from database as a list of hostgroups for a host and then recreating the hosts definition after appending new hostgroups using perl script.
Thank you for your inputs. I have now managed to get this information from database as a list of hostgroups for a host and then recreating the hosts definition after appending new hostgroups using perl script.
Re: Adding a hostgroup to a host definition using REST API
Awesome! Did you have additional questions regarding this topic, or can we close this thread?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Adding a hostgroup to a host definition using REST API
Yes.. We can close this thread. Thanks for your support