Bulk modify Hostgroup inheritance

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jvaira
Posts: 59
Joined: Tue Dec 22, 2015 7:40 pm

Bulk modify Hostgroup inheritance

Post by jvaira »

Hello,
I am looking for a way to enable hostgroup inheritance ( at the host level ) for all of our hosts. I thought setting this in the host template would do the trick but it looks like it needs to be set in both places to take affect. I have attached a screen shot for reference.
You do not have the required permissions to view the files attached to this post.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Bulk modify Hostgroup inheritance

Post by cdienger »

Hostgroups should be inheritable from a template. Did you do the following:

1. Edit the template to include a host group
2. apply the template to a host

?

It's may not be obvious in the UI, but if you look in /var/nagiosramdisk/objects.cache or /usr/local/nagios/var/objects.cache, and search for "hostgroup_name <yourhostgroupname> you should find a definition with all the host members.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jvaira
Posts: 59
Joined: Tue Dec 22, 2015 7:40 pm

Re: Bulk modify Hostgroup inheritance

Post by jvaira »

Hello @cdienger, Sorry maybe I wasn't explaining this very clearly. What I am trying to do is enable the additive option for hostgroup inheritance so that I can define a hostgroup in a template as well as within the hostgroups section of the host.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Bulk modify Hostgroup inheritance

Post by cdienger »

Ah. Thanks for the clarification. I'm not seeing a good way to do it in bulk in the web UI, but the setting is in the database:

Code: Select all

echo "select host_name, hostgroups_tploptions from tbl_host;" | mysql -uroot -pnagiosxi -Dnagiosql
The value in hostgroups_tploptins controls what is selected - 0 for additive, 1 for Null, 2 for standard.

Updating a current host would look like:

Code: Select all

update tbl_host set hostgroups_tploptions = 0 where host_name = localhost
Setting the default value(when adding a new host) to additive can be done too:

Code: Select all

ALTER TABLE tbl_host ALTER hostgroups_tploptions SET DEFAULT 0
We don't usually like making changes via direct sql calls like this since they not really tested and there's a risk of breaking things, so make sure to make a backup as a precaution if you go this route.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked