Hello,

I'm in the process to move our monitoring setup to icinga2. I still have
a problem related to notifications.

We have two masters in a ha-setup which should sent the notifications.

Notification should be sent to the support stuff a few times, once per
hour. Additionally one notification should be sent to the ticket system.

icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.6.3-1)

Copyright (c) 2012-2017 Icinga Development Team (https://www.icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid

System information:
  Platform: Debian GNU/Linux
  Platform version: 8 (jessie)
  Kernel: Linux
  Kernel version: 3.16.0-4-amd64
  Architecture: x86_64

Build information:
  Compiler: GNU 4.9.2
  Build host: smithers

Packages from packages.icinga.com


configuration file snippets:

/etc/icinga2/zones.d/master/notifications.conf:

apply Notification "mail-support" to Service {
  import "mail-service-notification"

  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users

  interval = 3600
  times = {
    begin = 0m
    end = 7h
  }

  assign where host.vars.notification.mail
}

apply Notification "mail-rt" to Service {
  import "mail-service-notification"

  user_groups = [ "dtn_rt3_group" ]

  interval = 0 // disable re-notification
  times = {
    begin = 0m
    end = 1h
  }

  assign where host.vars.notification.mail
}


user group dtn_support_group currently contains one user (myself).
I get the notification mails.
user group dtn_rt3_group contains the user with mail address for the
ticket system.
Unfortunately no mails were sent there.

In icingaweb2 for the service check I see both user group listed and
both users too.

Here are the two resulting notification of the above apply rules for one
service check:

icinga2 object list --name "DTN_win7-2*Diskspace C*" --type Notification
Object 'DTN_win7-2!Diskspace C!mail-support' of type 'Notification':
  % declared in '/etc/icinga2/zones.d/master/notifications.conf', lines 
46:1-46:44
  * __name = "DTN_win7-2!Diskspace C!mail-support"
  * command = "mail-service-notification"
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 63:3-63:39
  * command_endpoint = ""
  * host_name = "DTN_win7-2"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
46:1-46:44
  * interval = 3600
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
52:3-52:17
  * name = "mail-support"
  * package = "_etc"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
46:1-46:44
  * period = "24x7"
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 70:3-70:17
  * service_name = "Diskspace C"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
46:1-46:44
  * states = [ "OK", "Warning", "Critical", "Unknown" ]
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 65:3-65:45
  * templates = [ "mail-support", "mail-service-notification" ]
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
46:1-46:44
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 62:1-62:49
  * times
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
53:3-56:3
    * begin = 0
    * end = 25200
  * type = "Notification"
  * types = [ "Problem", "Acknowledgement", "Recovery", "Custom", 
"FlappingStart", "FlappingEnd", "DowntimeStart", "DowntimeEnd", 
"DowntimeRemoved" ]
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 66:3-68:57
  * user_groups = [ "dtn_support_group" ]
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
49:3-49:50
  * users = null
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
50:3-50:43
  * vars = null
  * zone = "dtn"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
46:1-46:44

Object 'DTN_win7-2!Diskspace C!mail-rt' of type 'Notification':
  % declared in '/etc/icinga2/zones.d/master/notifications.conf', lines 
76:1-76:39
  * __name = "DTN_win7-2!Diskspace C!mail-rt"
  * command = "mail-service-notification"
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 63:3-63:39
  * command_endpoint = ""
  * host_name = "DTN_win7-2"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
76:1-76:39
  * interval = 0
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
81:3-81:14
  * name = "mail-rt"
  * package = "_etc"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
76:1-76:39
  * period = "24x7"
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 70:3-70:17
  * service_name = "Diskspace C"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
76:1-76:39
  * states = [ "OK", "Warning", "Critical", "Unknown" ]
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 65:3-65:45
  * templates = [ "mail-rt", "mail-service-notification" ]
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
76:1-76:39
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 62:1-62:49
  * times
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
83:3-86:3
    * begin = 0
    * end = 3600
  * type = "Notification"
  * types = [ "Problem", "Acknowledgement", "Recovery", "Custom", 
"FlappingStart", "FlappingEnd", "DowntimeStart", "DowntimeEnd", 
"DowntimeRemoved" ]
    % = modified in '/etc/icinga2/zones.d/global-templates/templates.conf', 
lines 66:3-68:57
  * user_groups = [ "dtn_rt3_group" ]
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
79:3-79:35
  * users = null
  * vars = null
  * zone = "dtn"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 
76:1-76:39

I enabled debuglog feature

Hers the log part when state switched from soft to hard state:

[2017-05-09 16:26:34 +0200] debug/DbEvents: add log entry history for 
'DTN_win7-2!Diskspace C'
[2017-05-09 16:26:34 +0200] debug/DbEvents: add checkable check history for 
'DTN_win7-2!Diskspace C'
[2017-05-09 16:26:34 +0200] debug/GraphiteWriter: Add to metric 
list:'icinga2.DTN_win7-2.services.Diskspace_C.nscp.perfdata.C:__Used_Space.value
 36528696852.480003 1494339994'.
[2017-05-09 16:26:34 +0200] debug/DbEvents: add state change history for 
'DTN_win7-2!Diskspace C'
[2017-05-09 16:26:34 +0200] notice/Checkable: State Change: Checkable 
DTN_win7-2!Diskspace C hard state change from WARNING to WARNING detected.
[2017-05-09 16:26:34 +0200] information/Checkable: Checking for configured 
notifications for object 'DTN_win7-2!Diskspace C'
[2017-05-09 16:26:34 +0200] debug/Checkable: Checkable 'DTN_win7-2!Diskspace C' 
has 2 notification(s).
[2017-05-09 16:26:34 +0200] notice/Notification: Attempting to send  
notifications for notification object 'DTN_win7-2!Diskspace C!mail-support'.
[2017-05-09 16:26:34 +0200] information/Notification: Sending 'Problem' 
notification 'DTN_win7-2!Diskspace C!mail-support for user 'Markus.Lude'
[2017-05-09 16:26:34 +0200] debug/DbEvents: add notification history for 
'DTN_win7-2!Diskspace C'
[2017-05-09 16:26:34 +0200] debug/DbEvents: add contact notification history 
for service 'DTN_win7-2!Diskspace C' and user 'Markus.Lude'.
[2017-05-09 16:26:34 +0200] debug/DbEvents: add log entry history for 
'DTN_win7-2!Diskspace C'
[2017-05-09 16:26:34 +0200] information/Notification: Completed sending 
'Problem' notification 'DTN_win7-2!Diskspace C!mail-support' for checkable 
'DTN_win7-2!Diskspace C' and user 'Markus.Lude'.

nothing mentioned here about the second notification object
would be nice to see an entry showing why the second one isnt sent

any ideas/hints on how to debug this?

Regards,
Markus

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to