Services not getting contact_groups from host settings

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ksw139
Posts: 3
Joined: Thu Feb 20, 2014 8:35 pm

Services not getting contact_groups from host settings

Post by ksw139 »

As I understood it, if I add another group to the contact_groups on one of my hosts, the services associated with this host should use the same contact_groups. In my case, the services are all being associated by a hostgroup. Below are my settings... I don't think I have any problem with my contact or contact group, b/c I do get notifications properly on the host itself, just not on the services for that host. What am I doing wrong?

define host{
name windows-server ; The name of this host template
use generic-host ; Inherit default values from the generic-host template
check_period 24x7 ; By default, Windows servers are monitored round the clock
check_interval 5 ; Actively check the server every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if servers are "alive"
notification_period 24x7 ; Send notification out at any time - day or night
notification_interval 240 ; Resend notifications every 30 minutes
notification_options d,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
hostgroups windows-servers ; Host groups that Windows servers should be a member of
register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
}

define host{
use windows-server
host_name SQL1
alias SQL1
address 170.47.14.104
contact_groups SQL
}

define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}

define service{
use generic-service
hostgroup_name windows-servers
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Services not getting contact_groups from host settings

Post by lmiltchev »

What happens if you remove the "SQL" contact group from the " SQL1" host definition, and add it to the "windows-server" template?
Be sure to check out our Knowledgebase for helpful articles and solutions!
ksw139
Posts: 3
Joined: Thu Feb 20, 2014 8:35 pm

Re: Services not getting contact_groups from host settings

Post by ksw139 »

If I do that, won't it be the contact group for all windows servers that use that template? I was trying to just have this group receive notifications for my SQL servers only, which it does when i add the SQL group to the host, it's just not getting the services associated with that host. My admins group is already on as a contact_group on the template and I get notifications on everything just fine.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Services not getting contact_groups from host settings

Post by tmcdonald »

If your generic-service template is anything like mine, then the contact_groups is already set to "admin" meaning your Memory Usage service may not be inheriting from the host:

http://nagios.sourceforge.net/docs/3_0/ ... tance.html
2014-07-23 12_45_41-Object Inheritance.png
You might try adding "contact_groups +SQL" to your service definition.
Former Nagios employee
ksw139
Posts: 3
Joined: Thu Feb 20, 2014 8:35 pm

Re: Services not getting contact_groups from host settings

Post by ksw139 »

tmcdonald wrote:
You might try adding "contact_groups +SQL" to your service definition.
If I add contact_groups +SQL to my service def, won't that affect all hosts with that service?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Services not getting contact_groups from host settings

Post by tmcdonald »

You can always copy the service file and add the +SQL to the new one, and just make sure the only hosts in this new service config are the ones that need the SQL group, then remove those hosts from the old one.
Former Nagios employee
Locked