Page 1 of 1
How to add a Host to a service Group using NagiosXI rest API
Posted: Tue Jan 12, 2016 5:15 am
by parthiv39731
Hi,
I have the rest API to add a host to a single service but would like to know if there is any API available which can add a host to a service group?
thanks
Parthiv
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Tue Jan 12, 2016 12:24 pm
by lmiltchev
You can add a service to a host, hostgroup or a servicegroup. You can also add a host to a hostgroup. However, you cannot add a host to a servicegroup... unless I am missing something obvious. Let's step aside from the REST API for a while and see if this can be done at all in Nagios XI or Nagios Core. Can you show us an example config, demonstrating what you would like to accomplish?
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Wed Jan 13, 2016 11:41 am
by parthiv39731
my apologies, I got your point after going through the functionality on the portal. My goal is to register a set of standard services on a Host instead of adding the services one by one every time a server is provisioned. Based up your inputs I believe services can be added in to Host group and hence if the host is added in to the host group it would automatically subscribe to the services of the host group as well.
So is there any API which can be used for -
>>adding the host to the host group
>>adding the services to the host group
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Wed Jan 13, 2016 6:14 pm
by hsmith
Looking through the API documentation, I don't believe it is possible at the moment. I will reach out to the developers first thing tomorrow morning, and get a more official answer for you.
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Thu Jan 14, 2016 10:23 am
by hsmith
Once of our other support technicians informed me that we have a feature request in place for this, but it is not currently possible.
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Fri Jan 15, 2016 9:15 am
by parthiv39731
can it be done through any command line which can be executed on the Nagios Server.
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Fri Jan 15, 2016 10:38 am
by hsmith
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Mon Jan 18, 2016 11:39 pm
by parthiv39731
I was mostly looking for some CLI commands or scripts which can be run on the server to add the host to the host group. The link posted refers to something else.
Re: How to add a Host to a service Group using NagiosXI rest
Posted: Tue Jan 19, 2016 10:35 am
by hsmith
What I was getting at is you could write a script to write the configuration files, drop them in this directory, and then reapply the configuration. It's not the cleanest solution, but it's one route you can pursue.