Page 1 of 2
Assign contact by hostgroup
Posted: Thu Jun 20, 2013 5:45 pm
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.)
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 9:43 am
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 10:03 am
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)
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 10:31 am
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 10:34 am
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 10:39 am
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 10:42 am
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 12:27 pm
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 12:43 pm
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.
Re: Assign contact by hostgroup
Posted: Fri Jun 21, 2013 1:05 pm
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.