How to add a Host to a service Group using NagiosXI rest API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
parthiv39731
Posts: 8
Joined: Mon Dec 28, 2015 1:14 pm

How to add a Host to a service Group using NagiosXI rest API

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How to add a Host to a service Group using NagiosXI rest

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
parthiv39731
Posts: 8
Joined: Mon Dec 28, 2015 1:14 pm

Re: How to add a Host to a service Group using NagiosXI rest

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How to add a Host to a service Group using NagiosXI rest

Post 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.
Former Nagios Employee.
me.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How to add a Host to a service Group using NagiosXI rest

Post 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.
Former Nagios Employee.
me.
parthiv39731
Posts: 8
Joined: Mon Dec 28, 2015 1:14 pm

Re: How to add a Host to a service Group using NagiosXI rest

Post by parthiv39731 »

can it be done through any command line which can be executed on the Nagios Server.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How to add a Host to a service Group using NagiosXI rest

Post by hsmith »

Former Nagios Employee.
me.
parthiv39731
Posts: 8
Joined: Mon Dec 28, 2015 1:14 pm

Re: How to add a Host to a service Group using NagiosXI rest

Post 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.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How to add a Host to a service Group using NagiosXI rest

Post 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.
Former Nagios Employee.
me.
Locked