I am trying to use the apply notifications rule for services. Probably a lack of understanding but I do not get any service notifications. Here are my conf files for clarification.
services.conf
apply Service "ssh" {
import "generic-service"
check_command = "ssh"
assign where (host.address || host.address6) && host.vars.os == "Linux"
}
apply Service for (http_vhost => config in host.vars.http_vhosts) {
import "generic-service"
check_command = "http"
vars += config
}
apply Service for (disk => config in host.vars.disks) {
import "generic-service"
check_command = "disk"
vars += config
}
apply Service "icinga" {
import "generic-service"
check_command = "icinga"
assign where host.name == NodeName
}
apply Service "load" {
import "generic-service"
check_command = "load"
/* Used by the ScheduledDowntime apply rule in `downtimes.conf`. */
vars.backup_downtime = "02:00-03:00"
assign where host.name == NodeName
}
apply Service "procs" {
import "generic-service"
check_command = "procs"
assign where host.name == NodeName
}
apply Service "swap" {
import "generic-service"
check_command = "swap"
assign where host.name == NodeName
}
apply Service "users" {
import "generic-service"
check_command = "users"
assign where host.name == NodeName
}
notifications.conf
apply Notification "mail-icingaadmin" to Host {
import "mail-host-notification"
user_groups = [ "sysadmins" ]
assign where host.address !=" "
}
apply Notification "mail-icingaadmin" to Service {
import "mail-service-notification"
user_groups = [ "sysadmins" ]
assign where host.address !=""
}
please pick a category when creating a new topic - #community isn’t where this belongs, moved to #icinga-2-core
Pick one of these services, and send in a critical check result. Once it changes to a soft state, repeat the check result sending in to reach a hard state (typically 2/3 and then). Once the hard state is reached, a notification is sent.
This apply even when I select the faulting service type for example memory warning and select to send a custom notification? Because when I do this it still doesn’t send an email.
Hmmm Custom is a specific type which is currently allowed in your notification template. It just doesn’t work the same way as when triggering a critical state and sending a notification.
What does the icinga2.log say about the case when such a notification email should happen?
That looks like as if the host would send a notification, but actually uses the service notification scripts. In this scope, the host doesn’t have a service name.
Compare the timestamps from the logs with your current attempt, make sure this matches. The above is likely something from your previous tests - extract the current test timestamp and post the full line here.