Page 1 of 1
sending alert to multiple contact group
Posted: Thu Apr 30, 2015 3:10 pm
by pleegor
Hi,
I am trying to make notifications to be sent to various contact groups. I need an alert from on specific server in one host groups to be sent to multiple contact groups. When, I add contact_groups with a group name in hosts.cfg file alert is being sent only to contact group specified in the template.cfg template.
What is correct procedure and the syntax for setting up things like those? I am sure I am not the only who is trying to have this setup.
Thanks in advance!
Re: sending alert to multiple contact group
Posted: Thu Apr 30, 2015 3:18 pm
by ssax
Please post your relevant configurations for the host and template.
The definition is like so:
Code: Select all
contact_groups admins,anothergroup
Re: sending alert to multiple contact group
Posted: Thu Apr 30, 2015 3:22 pm
by jdalrymple
Works as expected:
Code: Select all
define contactgroup {
contactgroup_name contactgroup_a
alias A
members andy
}
define contactgroup {
contactgroup_name contactgroup_b
alias B
members bill
}
define host {
host_name host_a
use template_a
address 192.168.145.1
contact_groups contactgroup_a
}
define host {
host_name host_b
use template_b
address 192.168.145.1
contact_groups contactgroup_b
}
define host {
host_name host_c
use template_a
address 192.168.145.1
contact_groups contactgroup_a, contactgroup_b
}
Re: sending alert to multiple contact group
Posted: Thu Apr 30, 2015 3:35 pm
by pleegor
In my case I have one contact group defined in the template
this is host definition
Code: Select all
define host{
host_name mobile.demo
use linux-server
hostgroups demo
alias mobile.demo
address 172.x.x.x
check_command check-host-alive
check_interval 3
retry_interval 1
max_check_attempts 2
check_period 24x7
contact_groups mobile
process_perf_data 0
retain_nonstatus_information 0
notification_interval 10
notification_period 24x7
notification_options d,u,r
}
host template definition
Code: Select all
define host{
name mobile_demo
use generic-host
hostgroups
check_period 24x7
check_interval 5
max_check_attempts 10
check_command check-host-alive,
notification_period 24x7
notification_interval 10
notification_options d,u,r
contact_groups sys-admins
register 0
}
As you can see I want to add another contacts group for mobile.demo host and keep sys-admins in the host template
Re: sending alert to multiple contact group
Posted: Thu Apr 30, 2015 3:36 pm
by Box293
In your host definition you want:
Re: sending alert to multiple contact group
Posted: Fri May 01, 2015 12:27 am
by pleegor
I made the change (both suggestions) and now I am not getting any alerts. Just changed URL within in command.cfg to trigger and nothing happened...
This is how everything looks like now:
Code: Select all
define host{
host_name mobile.demo
use linux-server
hostgroups demo
alias mobile.demo.couchbase.com
address 172.23.105.16
check_command check-host-alive
check_interval 3
retry_interval 1
max_check_attempts 2
check_period 24x7
contact_groups +mobile
process_perf_data 0
retain_nonstatus_information 0
notification_interval 10
notification_period 24x7
notification_options d,u,r,f
}
hosts template:
Code: Select all
define host{
name mobile_demo
use generic-host
hostgroups
check_period 24x7
check_interval 5
max_check_attempts 10
check_command check-host-alive,
notification_period 24x7
notification_interval 10
notification_options d,u,r,f,s
contact_groups sys-admins
register 0
}
contact template:
Code: Select all
define contact{
contact_name pl33g0r
use generic-contact
alias pl33g0r
email [email protected]
}
define contactgroup{
contactgroup_name mobile
alias mobile-devs
members pl33g0r
}
Thanks for help again!
Re: sending alert to multiple contact group
Posted: Fri May 01, 2015 9:05 am
by Box293
A great way to test if a notification will work is to go to the object itself in the GUI and under Host Commands click "Send custom host notification".
Also, have a look in /usr/local/nagios/var/objects.cache and find the definition for the host mobile.demo, post it here.
Re: sending alert to multiple contact group
Posted: Mon May 11, 2015 6:43 pm
by pleegor
Sorry for such a late reply on this issue:
Code: Select all
define host {
host_name mobile.demo
alias mobile.demo.couchbase.com
address 172.23.105.16
check_period 24x7
check_command check-host-alive
contact_groups mobile-devs,sys-admins
notification_period 24x7
initial_state o
importance 0
check_interval 3.000000
retry_interval 1.000000
max_check_attempts 2
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 1
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,d,u,f
notifications_enabled 1
notification_interval 10.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 0
retain_status_information 1
retain_nonstatus_information 0
}
Re: sending alert to multiple contact group
Posted: Mon May 11, 2015 8:45 pm
by Box293
Did this work?
Box293 wrote:A great way to test if a notification will work is to go to the object itself in the GUI and under Host Commands click "Send custom host notification".
The host object looks good, we can see it is correctly getting both groups: "mobile-devs,sys-admins".
It might be easier if you could PM me a copy of /usr/local/nagios/var/objects.cache and I'll go over everthing to make sure it is OK.