Page 1 of 1

Add Host to HostGroup? Or add HostGroup to Host?

Posted: Tue May 30, 2017 1:10 pm
by MrWoodward
My team is trying to figure out the best way to manage Hosts, Host Groups, and Host Templates in Core Config Manager.

What we've observed with Nagios XI so far is that if one creates a Host, and then creates a Host Group and then adds the Host to the Host Group, if one examines the Host Management for that Host, under "Manage Host Groups" button, it shows zero (0) and no Host Groups are listed. Yet going directly to Host Group Management for that Host Group, the Host is indeed listed there.

If the reverse is done -- aka. If the HostGroup is added to the Host, the Host won't be listed in the HostGroup when examining the configuration.

Is this normal behavior?

If not, why/how is this happening? What can we do to correct it?

If it IS normal behavior, what's the best practice?

Re: Add Host to HostGroup? Or add HostGroup to Host?

Posted: Tue May 30, 2017 3:58 pm
by avandemore
It is normal, and the best practice is to use only one assignment method.

The viewing of this type of information I believe is being re-worked for later versions.

Re: Add Host to HostGroup? Or add HostGroup to Host?

Posted: Tue May 30, 2017 4:10 pm
by lmiltchev
This is a normal behavior. Nagios XI is using Nagios Core as the underlying engine. Adding a hostgroup to a host, or a host to a hostgroup is both valid. It doesn't make a difference in terms of monitoring how this relationship is defined. You can read more about the object definitions here: https://assets.nagios.com/downloads/nag ... tions.html, but in general when you can have:

//hostgroup added to a host

Code: Select all

define host {
	...
	hostgroups	hostgroup_names
	...
}
//host added to a hostgroup

Code: Select all

define hostgroup{
	...
	hostgroup_members  	hostgroups
	...
   	}
In Nagios XI (under the CCM->Hosts or CCM->Host Groups), you should be able to see both. If the host or the hostgroup has been added "the other way", its name would be "grayed out" as the relationship has been "defined elsewhere".

There is no right/wrong way of doing this. It's a matter of preference.

Re: Add Host to HostGroup? Or add HostGroup to Host?

Posted: Wed May 31, 2017 12:33 pm
by MrWoodward
Ok, great.

Do you have an guidance on advantages or disadvantages of one way or the other?

Re: Add Host to HostGroup? Or add HostGroup to Host?

Posted: Wed May 31, 2017 1:20 pm
by SteveBeauchemin
As an end user, what I do is
Make a Hostgroup
Make a Service test and add the hostgroup to the service. The service can have many hostgroups added to it.

From this point forward, every host you add to the Hostgroup will get that test.

That works for me...

Consider using naming conventions that tie the service and Hostgroup to each other.
I start all service names that are tied to host groups with svc_
I also name every Hostgroup that is tied to a service with hg_

So when I look at lists of Hostgroups and services, I know right away which are setup for a more complicated use case.

Thanks

Steve B

Re: Add Host to HostGroup? Or add HostGroup to Host?

Posted: Wed May 31, 2017 1:38 pm
by lmiltchev
Thank you @SteveBeauchemin!

Personally, I always prefer to add hosts (members) to a hostgroup. It's easier to bulk add/remove members this way. You can also use "*" to add all hosts to a hostgroup (see this: https://assets.nagios.com/downloads/nag ... #hostgroup.

If you added your hosts via config wizards, and specified a hostgroup in step 5, then the hostgroup would be added to the host definition. In this case, it would be more difficult to mass add/remove hostgroups from multiple hosts in the CCM unless you use Nagios XI Enterprise Edition.

Hope this helps.