Assign contact by hostgroup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Assign contact by hostgroup

Post by tonyyarusso »

I'd like to be able to have all similar hosts have the same contact setting based on their hostgroup membership. In other words, "All members of hostgroup foo should have a contact of bar". However, I don't seem to be able to set a contact in a hostgroup definition. Can I do this? Or would have have to add a template to each and every host in addition to adding them to the hostgroup? (I really don't want to have to add a template to every host for this, because the wizards only support adding hostgroups, not templates, which would mean I'd have to resort to the CCM for everything.)
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Assign contact by hostgroup

Post by sreinhardt »

Alas, you will have to apply templates via ccm, unless you want to create various contact groups. Unfortunately as you cannot add a template via a hostgroup association, and since the wizards don't go through template selection, there isn't much option. I do find it a valid point to ask why we don't allow template addition via wizards at this point.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
BanditBBS
Posts: 2460
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Assign contact by hostgroup

Post by BanditBBS »

Just create the template and in the template config you can say apply it to a specific hostgroup. Then, any host added to that hostgroup will automatically have the template assigned. (unless I misunderstood something)
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Assign contact by hostgroup

Post by tonyyarusso »

BanditBBS wrote:Just create the template and in the template config you can say apply it to a specific hostgroup.
The 'use' directive doesn't appear to be valid in a hostgroup definition either - apparently the hostgroup object is pretty crippled in what it can do.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
User avatar
BanditBBS
Posts: 2460
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Assign contact by hostgroup

Post by BanditBBS »

tonyyarusso wrote:
BanditBBS wrote:Just create the template and in the template config you can say apply it to a specific hostgroup.
The 'use' directive doesn't appear to be valid in a hostgroup definition either - apparently the hostgroup object is pretty crippled in what it can do.
No, go into CCM - templates. Create a new one and you will see a button labeled "Host groups"

If you select that button and then add whatever hostgroups you want, those hostgroups and any hosts in the hostgroups will have the template applied. Which can include alert settings like you want. When adding hosts to hostgroups when using wizards you will get the settings you want.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Assign contact by hostgroup

Post by sreinhardt »

Unfortunately, this works the opposite way, anything that inherits the template gets the hostgroup. The hostgroup does not apply the template to anything. I have tested this logic out on a couple different things. If you find out some way to do it that I missed, that would be cool.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
BanditBBS
Posts: 2460
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Assign contact by hostgroup

Post by BanditBBS »

sreinhardt wrote:Unfortunately, this works the opposite way, anything that inherits the template gets the hostgroup. The hostgroup does not apply the template to anything. I have tested this logic out on a couple different things. If you find out some way to do it that I missed, that would be cool.
Ahh, and there is the item I am missing. Darn, would have been nice to work that way.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Assign contact by hostgroup

Post by tonyyarusso »

Okay, so since it sounds like the Nagios config structure doesn't allow this (feature request anyone?), I'm going to see if I can write a script to fuss with the NagiosQL MySQL database to accomplish it for me, then just run that from cron.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Assign contact by hostgroup

Post by abrist »

tonyyarusso wrote: (I really don't want to have to add a template to every host for this, because the wizards only support adding hostgroups, not templates, which would mean I'd have to resort to the CCM for everything.)
We just got done talking about this in a meeting, and template functionality has been left out of wizards on purpose as standard users have the ability to run wizards, and allowing template capabilities for standard users can lead to undesired consequences (breakage/security issues). Not to mention the wizards make use of their templates as well.
tonyyarusso wrote:Ahh, and there is the item I am missing. Darn, would have been nice to work that way.
I am not sure on the logic for it, but a feature request is an option, though it may be denied due to the way that ql and core handles templates and hostgroups.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Assign contact by hostgroup

Post by tonyyarusso »

abrist wrote:I am not sure on the logic for it, but a feature request is an option, though it may be denied due to the way that ql and core handles templates and hostgroups.
Yeah, it would need to be a feature request against Core from the looks of it, which would then need to also be implemented by the QL people.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
Locked