Hello,
I’m having trouble setting up notifications.
In the first step, I would like to generally send notifications for changes to hosts and services.
When I call the notification scripts from the command line, an email is sent correctly.
Also, when I manually send a notification to a host or service via Icingaweb2, it works if I force it to be sent. Without forcing the message, no email will be sent.
Only the notifications that I have forced appear in the notification history.
So I don’t get the expected state changes, too.
Since the dispatch generally works and the forced mails arrive, I suspect that I have an error in the apply rules for the notifications. So far, however, this is only a suspicion.
I have already checked the logs, but I cannot find any abnormalities there.
I would appreciate your help with the configuration.
In the previous configuration, I followed the instructions below:
https://dokuwiki.nausch.org/doku.php/centos:web_c7:icinga:director#benachrichtigungen
Give as much information as you can, e.g.
- Director version (System - About): 1.8.1
- Icinga Web 2 version and modules (System - About): 2.9.3
- Icinga 2 version (
icinga2 --version
): r2.13.1-1 - Operating System and version: Debian 10
- Webserver, PHP versions: 7.3.31-1~deb10u1
zones.d/director-global/timeperiods.conf
object TimePeriod "24/7" {
import "legacy-timeperiod"
display_name = "24/7"
ranges = {
}
}
zones.d/master/notification_templates.conf
template Notification "generic_host_notification" {
command = "mail-host-notification"
period = "24/7"
user_groups = [ "admin" ]
}
zones.d/master/notification_templates.conf
template Notification "generic_service_notification" {
command = "mail-service-notification"
period = "24/7"
user_groups = [ "admin" ]
}
zones.d/master/notification_apply.conf
apply Notification "host_warning_notification" to Host {
import "generic_host_notification"
assign where host.check_command == "hostalive"
states = [ Down, Up ]
types = [ Custom, Problem, Recovery ]
}
zones.d/master/notification_apply.conf
apply Notification "service_warning_notification" to Service {
import "generic_service_notification"
assign where match("check*", service.name)
states = [ Critical, OK, Unknown, Warning ]
types = [ Custom, Problem, Recovery ]
}
zones.d/master/notification_apply.conf
apply Notification "Notification APT Update" to Service {
import "generic_service_notification"
interval = 0s
assign where service.display_name == "check_apt"
states = [ Critical, Unknown, Warning ]
types = [ Custom, Problem, Recovery ]
user_groups = [ "admin" ]
}
zones.d/master/usergroups.conf
object UserGroup "admin" {
display_name = "admin"
}
zones.d/director-global/user_templates.conf
template User "admin" {
enable_notifications = true
groups = [ "admin" ]
}
zones.d/master/users.conf
object User "Alexander" {
import "admin"
display_name = "Alexander"
email = "email@adress.com"
groups = [ "admin" ]
}
Thanks in advance,
Alex