Add Host to HostGroup? Or add HostGroup to Host?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

Add Host to HostGroup? Or add HostGroup to Host?

Post 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?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

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

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

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

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

Post by MrWoodward »

Ok, great.

Do you have an guidance on advantages or disadvantages of one way or the other?
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

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

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked