Hello all,
I would like to send a notification to a user group via email as soon as I confirm an service problem.
For this I have made the following settings in the Icinga2 Direcor:
apply Notification “Services” to Service {
command = “notify_service_by_mail”
interval = 0s
period = “everytime”
assign where match("*", service.name)
states = [ Critical, OK, Unknown, Warning ]
types = [ Acknowledgement, Custom ] user_groups = [ “Admins” ] }
user_groups = [ “Admins” ]
}
object User “Marco” {
email = “marco@xxx.de ”
enable_notifications = true
period = “everytime”
states = [ Critical, Down, OK, Unknown, Up, Warning ]
types = [
Acknowledgement,
Custom,
DowntimeEnd,
DowntimeRemoved,
DowntimeStart,
FlappingEnd,
FlappingStart,
Problem,
Recovery
]
groups = [ “Test”, “Admins” ]
}
Now when I confirm a sensor that is in Warning, or Critical status, no notification is sent.
What do I wrong?
Thx for any help!
Marco
no idea? is the configuration right?
Still the same problem
when i acknowlege a critical alarm, in the history I the following message:
this notification was not sent out to any contact
In the log I see following log entry:
[2021-07-29 09:07:44 +0200] information/Checkable: Checkable 'xxxMON1.xxx.local!Sophos Central - Status' has 1 notification(s). Checking filters for type 'Acknowledgement', sends will be logged.
zones.d/master/notification_apply.conf
apply Notification "AcknowledgedService" to Service {
command = "notify_service_by_mail"
period = "everytime"
assign where service.vars.ack_service
# also try: assign where service.name
# also try: assign where match("*", service.name)
states = [ Critical, OK, Unknown, Warning ]
types = [ Acknowledgement, Custom ]
users = [ "Marco" ]
}
zones.d/master/users.conf
object User "Marco" {
email = "marco@xxx.de"
enable_notifications = true
period = "everytime"
states = [ Critical, Down, OK, Unknown, Up, Warning ]
types = [
Acknowledgement,
Custom,
DowntimeEnd,
DowntimeRemoved,
DowntimeStart,
FlappingEnd,
FlappingStart,
Problem,
Recovery
]
groups = [ "Admin" ]
}
zones.d/director-global/timeperiods.conf
object TimePeriod "everytime" {
import "legacy-timeperiod"
ranges = {
"friday" = "00:00-24:00"
"monday" = "00:00-24:00"
"saturday" = "00:00-24:00"
"sunday" = "00:00-24:00"
"thursday" = "00:00-24:00"
"tuesday" = "00:00-24:00"
"wednesday" = "00:00-24:00"
}
}
jbrost
(Julian Brost)
July 30, 2021, 1:48pm
4
If I remember correctly, Icinga will only send acknowledgement notifications if it notified for the problem that is being acknowledged, so that filter might be the cause:
So you could try adding Problem
there and see if this also enables ack notifications. I understand that you probably have a reason for not listing problem there but you could at least try to see if that’s the cause. As far as I know, there’s no way to change this behavior right now, unfortunately.
Hi, when I add “Problem” I get everytime a mail, when a sensor change his state to “Critical, Warning, or Unkown”
The subject starts with [problem]…
That shows me that the Benachrichtig basically works?!?
Maybe I should post an error message on github?
Pooh
(Antony Stone)
August 1, 2021, 10:01am
6
Yes, but the important point is “do you now get the Achnowledgement
notifications as well?”
If you don’t want to receive the Problem reports, you can easily filter those
out in your notification sending script.
Antony.
Hello,
first, THANKS FOR ANY HELP HERE!
now the notification works when an alarm is confirmed by email.
But this behavior is not logical for me. I would expect the Acknowlegement type to be sufficient.
How can I filter out the “problem” messages?
Hi,
i create a new issue on github:
opened 02:28PM - 03 Aug 21 UTC
## Expected Behavior
I created in the Icinga2 Director a notification rule fo… r Acknowledge critical, or warning sensors. When I acknowledge a Critical, or warning Sensor I except, that icinga2 send a mail.
```
zones.d/master/notification_apply.conf
apply Notification "AcknowledgedService" to Service {
command = "notify_service_by_mail"
period = "everytime"
assign where match("*", service.name)
states = [ Critical, OK, Unknown, Warning ]
types = [ Acknowledgement, Custom ]
users = [ "Marco" ]
}
```
```
zones.d/master/users.conf
object User "Marco" {
email = "marco@xxx.de"
enable_notifications = true
period = "everytime"
states = [ Critical, Down, OK, Unknown, Up, Warning ]
types = [
Acknowledgement,
Custom,
DowntimeEnd,
DowntimeRemoved,
DowntimeStart,
FlappingEnd,
FlappingStart,
Problem,
Recovery
]
groups = [ "Admin" ]
}
```
```
zones.d/director-global/timeperiods.conf
object TimePeriod "everytime" {
import "legacy-timeperiod"
ranges = {
"friday" = "00:00-24:00"
"monday" = "00:00-24:00"
"saturday" = "00:00-24:00"
"sunday" = "00:00-24:00"
"thursday" = "00:00-24:00"
"tuesday" = "00:00-24:00"
"wednesday" = "00:00-24:00"
}
}
```
## Current Behavior
I don't get a email, in the history logged, that the notifcation was not send to any contact:

## Possible Solution
When I add in the notification rule (notification_apply.conf) the type "Problem" I get mails, when I acknowlege a critical Sensor.
The Problem is, now I get evertime a Mail, when a State of a Sensor changed to critical/warning/unknown
Is this a bug, or a configuration failure? I Think this problem is a bug, because i exept, that the notification "Acknowledgement" type is the correct selection.
I understand the Problem-Type so, that a email send, when a sensor change his state from "OK" to "Critical", "Warning", or "Unknown" and the Type "Acknowledgement" send a mail, when i Acknowledge a "Critical", "Warning", or "Unknown" sensor?!? I'm wrong?
## Steps to Reproduce (for bugs)
Add in the Notification Rule the Type Problem:
```
zones.d/master/notification_apply.conf
apply Notification "AcknowledgedService" to Service {
command = "notify_service_by_mail"
period = "everytime"
assign where match("*", service.name)
states = [ Critical, OK, Unknown, Warning ]
types = [ Acknowledgement, Custom, Problem ]
users = [ "Marco" ]
}
```
## Your Environment
* Director version (System - About): master
* Icinga Web 2 version and modules (System - About): 2.9.2
* Icinga 2 version (`icinga2 --version`): 2.12.5-2
* Operating System and version: CentOS Linux 8
* Webserver, PHP versions: NGINX 1:1.14.1-9.module_el8.0.0+184+e34fea82, PHP 7.2.24
Hi,
since last update to icinga 2.13 my problem solved!
1 Like