shinken
shinken copied to clipboard
Multiple notification send when contact are in the same group and use generic-contact template
Hello, I have an issue with multiple notification on Shinken 2.4.3 I have 2 contacts who use 2 differents notification commands. This contacts use the default generic-contact template and are in a same contact groups. When a notification is rised, 6 notications are send :
Here is the log from scheduler for a host problem
[1471628293] HOST NOTIFICATION: testUser2;172.17.0.25;DOWN;notify-host-by-email1;CRITICAL - Host Unreachable (172.17.0.25)
[1471628293] HOST NOTIFICATION: testUser2;172.17.0.25;DOWN;notify-host-by-email2;CRITICAL - Host Unreachable (172.17.0.25)
[1471628293] HOST NOTIFICATION: testUser2;172.17.0.25;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.17.0.25)
[1471628293] HOST NOTIFICATION: testUser1;172.17.0.25;DOWN;notify-host-by-email1;CRITICAL - Host Unreachable (172.17.0.25)
[1471628293] HOST NOTIFICATION: testUser1;172.17.0.25;DOWN;notify-host-by-email2;CRITICAL - Host Unreachable (172.17.0.25)
[1471628293] HOST NOTIFICATION: testUser1;172.17.0.25;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.17.0.25)
It looks like each contacts who use the same template obtain the notification command from other contacts who use the same template. The problem is gone when we don't use the template generic-contact.
Here is the configuration I used to make this test (generic-host and generic-contact are the default template from Shinken)
define host{
use generic-host
host_name 172.17.0.25
address 172.17.0.25
contact_groups testGroup
}
define contact{
use generic-contact
contact_name testUser1
email test1.com
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_commands notify-host-by-email1
service_notification_commands notify-service-by-email
host_notification_options d,u,r,f,s
service_notification_options c,w,r
}
define contact{
use generic-contact
contact_name testUser2
email test2.com
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_commands notify-host-by-email2
service_notification_commands notify-service-by-email
host_notification_options d,u,r,f,s
service_notification_options c,w,r
}
define command {
command_name notify-host-by-email1
command_line $PLUGINSDIR$/notify_by_email.py -n host -S localhost -r $CONTACTEMAIL$ -f html -c '$NOTIFICATIONTYPE$,,$HOSTNAME$,,$HOSTADDRESS$,,$LONGDATETIME$' -o '$HOSTSTATE$,,$HOSTDURATION$'
}
define command {
command_name notify-host-by-email2
command_line $PLUGINSDIR$/notify_by_email.py -n host -S localhost -r $CONTACTEMAIL$ -f html -c '$NOTIFICATIONTYPE$,,$HOSTNAME$,,$HOSTADDRESS$,,$LONGDATETIME$' -o '$HOSTSTATE$,,$HOSTDURATION$'
}
define contactgroup{
contactgroup_name testGroup
alias testGroup
members testUser1,testUser2
}
I will try to write a test for this case
NB: I have just written a test. It seems the problems appears only if the template use a notificationway
Proposed PR: #1867