Page 1 of 1

HostGroup and Host relation

Posted: Tue Feb 07, 2012 2:58 pm
by Mitchell
I am not sure if this is a bug or it is supposed to work this way only. Here is what I observed..
I created 100 hosts
then created 1 hostgroup and added all the existing hosts under this hostgroup
then created a service and assigned it to hostgroup. Very cool.. it worked.

now I created another 50 hosts and assigned to the existing host group. great.. it automatically started monitoring services.

I wanted to remove this service monitor from 1 host, so edited hostgroup and tried removing the host. :o . I did not find the host in hostgroup however it was monitoring service. :o

after looking at different config files realized that the host defination was having hostgroup membership :shock: .

it seems editing a host -> adding to hostgroup is different than editing a hostgroup -> adding a host :?:

Can someone please confirm if this is expected?

Thanks
Ashish

Re: HostGroup and Host relation

Posted: Tue Feb 07, 2012 4:03 pm
by scottwilkerson
If it is added in both places, it would need to be removed from both places. If it is found in either direction it will still show up.

Re: HostGroup and Host relation

Posted: Tue Feb 07, 2012 4:14 pm
by Mitchell
Thanks for confirming. so as far as getting a service monitor created by adding a host TO hostgroup or adding a host IN hostgroup, it wii work. I understand it now.

Which one is better way if we relate this to resource utilization (CPU, IO) on nagiosXI server?
How can I bulk edit the hosts? I am trying to remove all the hostgroup from every host and will explicitly add these hosts in Hostgroup defination.

Thanks again for your help and support.

Re: HostGroup and Host relation

Posted: Tue Feb 07, 2012 5:05 pm
by scottwilkerson
Mitchell wrote:Which one is better way if we relate this to resource utilization (CPU, IO) on nagiosXI server?
It really shouldn't matter either way, it is all calculated when the monitoring engine starts.
Mitchell wrote:How can I bulk edit the hosts?
Unfortunately at this time there is no easy way to bulk edit the hosts, unless you have a SQL wiz to modify the nagiosql MySQL database (if you attemt this be sure you have a database backup) and then Apply the configuration after the changes.

Re: HostGroup and Host relation

Posted: Wed Feb 08, 2012 5:31 pm
by mguthrie
I find that the easiest way to manage hosts/hostgroups is either by assigning the relationship from the hostgroups page, so they're all in one place. Or the other nice way to do it is to assign hostgroup information in a template. This requires some initial setup, but later on it's a nice and easy way to add new hosts.

Re: HostGroup and Host relation

Posted: Wed Feb 08, 2012 5:58 pm
by Mitchell
Thank you. I also reached to the same conclusion that best place to maintain this relationship is in hostgroup defination. Host template is a good place but I feel that for our setup, it will be difficult to maintain multiple host templates to maintain hostgroup membership.
regardless, whereever it is maintained, should be same way for every host to keep it clean.

Thanks again for your help.

Re: HostGroup and Host relation

Posted: Wed Feb 08, 2012 6:17 pm
by Mitchell
mguthrie wrote:I find that the easiest way to manage hosts/hostgroups is either by assigning the relationship from the hostgroups page, so they're all in one place. Or the other nice way to do it is to assign hostgroup information in a template. This requires some initial setup, but later on it's a nice and easy way to add new hosts.

I see that when we define template, we dont have to specify each field. which means, it pulls from some core configuration. Where can I find that core-configuration? Also where can I see the detailed explaination of each field. The information pop-up next to each field does not have full explaination.

Re: HostGroup and Host relation

Posted: Thu Feb 09, 2012 12:19 pm
by scottwilkerson
In XI, these templates are located in the Core Config Manager under templates Host/Service/Contact templates.

Whatever you have in the template is applied to the Host/Service/Contact that you attach the template to.

Any setting made to the Host/Service/Contact directly will overwrite the template value unless it is specified + for additive, then it would be in addition to the template.

Additional template documentation can be found here.
http://library.nagios.com/training/self ... -templates
http://nagios.sourceforge.net/docs/3_0/ ... tance.html

XI writes the templates in Nagios core files every time you apply configuration, so while I will tell you where they are, if you change them directly they will not have a lasting affect.

the template files are
contactgroups.cfg
hosttemplates.cfg
servicetemplates.cfg