Assign contact by hostgroup
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Assign contact by hostgroup
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.)
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Assign contact by hostgroup
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.
Re: Assign contact by hostgroup
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
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
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Assign contact by 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.BanditBBS wrote:Just create the template and in the template config you can say apply it to a specific hostgroup.
Re: Assign contact by hostgroup
No, go into CCM - templates. Create a new one and you will see a button labeled "Host groups"tonyyarusso wrote: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.BanditBBS wrote:Just create the template and in the template config you can say apply it to a specific hostgroup.
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
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
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Assign contact by hostgroup
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.
Re: Assign contact by hostgroup
Ahh, and there is the item I am missing. Darn, would have been nice to work that way.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.
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
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
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Assign contact by hostgroup
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
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: (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.)
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.tonyyarusso wrote:Ahh, and there is the item I am missing. Darn, would have been nice to work that way.
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.
"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.
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Assign contact by hostgroup
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.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.