Notification by mail

Hello,
I have little problem in notification , my hosts are sending notification when the status are warning and critical and thats okay for me , but there is one host when the status of disk is warning he is not sending me any notification ( the configuration is the same for that hosts and others works perfectaly)
does anyone has this issue before ?
hope that will save the notification part
Thanks

Whithout sharing the config it’s like a shot in the dark :wink:
So could you pls so kind and share the config? From the host, from the notification command, the contacts etc

I’m sorry for not sharing this , it was my bad ,
here is the host.conf configuration

object Endpoint “ansiblecontroller.icosnetcloud.com” {
}

object Zone “ansiblecontroller.x.x.x.x.com” {
endpoints = [ “ansiblecontroller.icosnetcloud.com” ]
parent = “master”
}

// Host Objects
object Host “ansiblecontroller.x.x.x.x.com” {
import “generic-host”
check_command = “dummy”
address = “x.x.x.x”
display_name = “ANSIBLE CONTROLLER”
vars.client_endpoint = name
}
vars.notification[“mail”] = {
groups = [ “icingaadmins” ]
users = [“icingaadmin”]
}
enable_notifications = true
vars.notification_type = “email”

i have applied the service for disk to all the server :slight_smile:

apply Service “Disk” {
check_command = “disk”
command_endpoint = host_name
assign where host.vars.client_endpoint
//vars.local_disks = [ “/”, “/home”, “/var”, “/var/log”, “/var/log/audit”, “/var/tmp” ,"/dev" ]
vars.disk_exact_match = true
vars.disk_all = true
vars.disk_units = “GB”
vars.notification[“mail”] = {
groups = [ “icingaadmins” ]
users = [“icingaadmin”]
}
enable_notifications = true
vars.notification_type = “email”
}

for the notification.conf file :

apply Notification “mail-icingaadmin” to Host {
import “mail-host-notification”
user_groups = host.vars.notification.mail.groups
users = host.vars.notification.mail.users
vars.notification_from = “Icinga Notifications icinga-notif@icosnet.com
interval = 0//1h
users = [“icingaadmin”,“root-admin”]
//vars.notification_logtosyslog = true
assign where host.vars.notification.mail
}

apply Notification “mail-icingaadmin” to Service {
import “mail-service-notification”
user_groups = host.vars.notification.mail.groups
users = host.vars.notification.mail.users
vars.notification_from = “Icinga Notifications icinga-notif@icosnet.com
interval = 0 //1h
period = “24x7”
users = [“icingaadmin”,“root-admin”]
//vars.notification_logtosyslog = true
assign where host.vars.notification.mail
}

Thank you again.

Hi,

maybe it is this line at your notification definition for the service:

assign where host.vars.notification.mail

that mean you assign this to the host not to the notification var in your service.

That should work either way, as you assign the notifications to service objects of a host that has host.vars.notifications set.

@mouhssine please check via the API if the notifications really are applied:
https://monitoringhost:5665/v1/objects/notifications?filter=match(%22myhostname%22,%20host.name)
Just open this in your browser, login with the API credentials (most likely under /etc/icinga2/conf.d/api-users.conf) and check if you host has a notification for the disk service.

If yes: check /var/log/icinga2/icinga2.log around the time you are expecting the notification for the disk check to be sent. The log should pretty much tell you why the notification was not sent.

yes it should. But just an idea while I compared our notification rules and what the Director is rendering in our setup