Hostgroup within a hostgroup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Hostgroup within a hostgroup

Post by derekb »

Hi there,
I have a question about nested host groups. This is somewhat working on our XI 5.2.5 installation on CentOS6.

Essentially, I make a hostgroup for each "customer site" with their address information, a notes field etc that is passed in the email alert.
I then group THOSE hostgroups by the type of service -- in our case, let's just say "INTERNET CUSTOMERS".

Here is an example of how I have set things up:

- Created host group ABC, populated details like notes, etc.
- Host ABC - 1.2.3.4, clicked 'Managed Host Groups', added Host ABC to Host Group ABC.
- Opened existing host group 'INTERNET CUSTOMERS', clicked 'Manage Host Groups', and added host group ABC.

In most cases, NAGIOS will show me the information from 'Host group ABC' when I get the email alert which is what we want. However, some times I'll get the information from the 'INTERNET CUSTOMERS' host group.

Example of a good alert/email. It pulled the information from Hostgroup ABC and displayed it correctly in the alert.

Code: Select all

Nagios has detected this host has recovered.

Notification Type: RECOVERY

Customer Information:
Hostgroup: ABC Company
Site Address: 1234 Front Road, City, State
Sharepoint URL: http://someurl
Notes: ISP Order #: EMC-66-01

Host Information:
Host: ABC Company - Internet Modem
State: UP
Address: 10.40.100.218
Info: OK - 10.40.100.218: rta 12.650ms, lost 0%
Date/Time: 2016-02-10 01:59:07
Example of a bad alert, where the information is pulled from hostgroup 'INTERNET CUSTOMERS':

Code: Select all

Nagios has detected a problem with this host.

Notification Type: PROBLEM

Customer Information:
Hostgroup: Internet Customers
Site Address: Internet Customers
Sharepoint URL: 
Notes: 

Host Information:
Host: ABC Company - Internet Modem
State: DOWN
Address: 10.40.100.194
Info: CRITICAL - 10.40.100.194: rta nan, lost 100%
Date/Time: 2016-03-22 08:18:33
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: Hostgroup within a hostgroup

Post by vAJ »

About the only way I can think of doing this is with Host Templates. Because a hostgroup itself cannot have custom variable defined to it. It's merely a grouping mechanism.

Host template for each customer. Then you'd set 'free variable definitions' for that template and apply it to the hosts or hostgroups.
Andrew J. - Do you even grok?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Hostgroup within a hostgroup

Post by tmcdonald »

vAJ wrote:Then you'd set 'free variable definitions' for that template and apply it to the hosts or hostgroups.
To clarify, you can't assign a host template "to" a host group - when you define a hostgroup setting in a template you are saying that any host using that template should go in that hostgroup, NOT that any host in that hostgroup should use that template. This is a very important distinction to make.

In regards to the issue at hand, this almost seems like a bug. Does the behavior only change after you have done an Apply Config or otherwise restarted the nagios process? Even if it doesn't make sense which group's info is included, it should still at least be consistent.
Former Nagios employee
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: Hostgroup within a hostgroup

Post by vAJ »

Yes, sorry, I wasn't suggesting to set the hostgroup in the host template. Just that that template should be applied to the respective hosts or Hostgroup. This can only be done by way of the Bulk Modifications Tool, which I believe is Enterprise license only.

-Andrew
Andrew J. - Do you even grok?
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Re: Hostgroup within a hostgroup

Post by derekb »

tmcdonald wrote:
vAJ wrote:Then you'd set 'free variable definitions' for that template and apply it to the hosts or hostgroups.
To clarify, you can't assign a host template "to" a host group - when you define a hostgroup setting in a template you are saying that any host using that template should go in that hostgroup, NOT that any host in that hostgroup should use that template. This is a very important distinction to make.

In regards to the issue at hand, this almost seems like a bug. Does the behavior only change after you have done an Apply Config or otherwise restarted the nagios process? Even if it doesn't make sense which group's info is included, it should still at least be consistent.
Hi, and thanks for the reply.
It seems to be sporadic. It will be fine for a host and host group, then fail and display the incorrect host group information. Going into the host and host group and reapplying settings fixes it for the week/month.

It doesn't seem to happen with all hosts and groups.

Is there a preferred way to do what I'm trying to accomplish? I guess what I'm asking is, what SHOULD Nagios be doing with the method I described in the initial post? I want to make sure MY actions are correct before anything else
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Hostgroup within a hostgroup

Post by lmiltchev »

Let's take a look at your configs first. If this is a bug, we will need to try to recreate it in house.

One thing that seems weird to me though is that in your notifications you have the same host with a different IP address...
Host: ABC Company - Internet Modem
State: UP
Address: 10.40.100.218

Host: ABC Company - Internet Modem
State: DOWN
Address: 10.40.100.194
Do you have two different hosts with the same name? Please, show us the configs of the "problem" host, the "ABC Company", and the "Internet Customers" hostgroups.
Be sure to check out our Knowledgebase for helpful articles and solutions!
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Re: Hostgroup within a hostgroup

Post by derekb »

lmiltchev wrote:Let's take a look at your configs first. If this is a bug, we will need to try to recreate it in house.

One thing that seems weird to me though is that in your notifications you have the same host with a different IP address...
Host: ABC Company - Internet Modem
State: UP
Address: 10.40.100.218

Host: ABC Company - Internet Modem
State: DOWN
Address: 10.40.100.194
Do you have two different hosts with the same name? Please, show us the configs of the "problem" host, the "ABC Company", and the "Internet Customers" hostgroups.
Sorry, I just copy/pasted some alerts and changed the host name to something generic. Didn't realize I pasted 2 different IP's.

How would you like to see the configs, exactly? Screenshots of something? Output of some CLI stuff?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Hostgroup within a hostgroup

Post by lmiltchev »

How would you like to see the configs, exactly? Screenshots of something? Output of some CLI stuff?
CCM->Hosts->ABC->View Text Config (the diskette icon)
CCM->Host Groups->View Text Config (the diskette icon)

Copy the configs in code wraps. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Re: Hostgroup within a hostgroup

Post by derekb »

lmiltchev wrote:
How would you like to see the configs, exactly? Screenshots of something? Output of some CLI stuff?
CCM->Hosts->ABC->View Text Config (the diskette icon)
CCM->Host Groups->View Text Config (the diskette icon)

Copy the configs in code wraps. Thanks!
Sorry I never knew about that feature! I'll get back to you in the AM. Just wanted to say thanks to all of you that are so helpful on the forums. Customers like us really appreciate it
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Hostgroup within a hostgroup

Post by lmiltchev »

Sorry I never knew about that feature! I'll get back to you in the AM. Just wanted to say thanks to all of you that are so helpful on the forums. Customers like us really appreciate it
You are welcome, derekb! Let us know when you have the configs.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked