Icinga2 Email Notifications not working - Checkable 'hostname' does not have any notifications

We have noticed that email alerts are not working after enabling notifications and getting below error in log when we manually send notification via web.
Checkable 'hostname' does not have any notifications

Version used: icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.4-1)

Copyright (c) 2012-2019 Icinga GmbH (https://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.

System information:
Platform: Ubuntu
Platform version: 18.04.2 LTS (Bionic Beaver)
Kernel: Linux
Kernel version: 4.15.0-1037-aws
Architecture: x86_64

Build information:
Compiler: GNU 7.3.0
Build host: b2ecadfb68ab

Application information:

General paths:
Config directory: /etc/icinga2
Data directory: /var/lib/icinga2
Log directory: /var/log/icinga2
Cache directory: /var/cache/icinga2
Spool directory: /var/spool/icinga2
Run directory: /run/icinga2

Old paths (deprecated):
Installation root: /usr
Sysconf directory: /etc
Run directory (base): /run
Local state directory: /var

Internal paths:
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
`
  • Operating System and version: Ubuntu 18.04.2 LTS
  • Enabled features ( icinga2 feature list ): Disabled features: compatlog debuglog elasticsearch gelf graphite influxdb livestatus opentsdb perfdata statusdata syslog Enabled features: api checker command ido-mysql mainlog notification
  • Icinga Web 2 version and modules (System - About): Icinga Web 2 Version 2.6.3Loaded modulesmonitoring 2.6.3
  • Config validation ( icinga2 daemon -C ): `[2019-05-09 04:59:06 +0000] information/cli: Icinga application loader (version: r2.10.4-1) [2019-05-09 04:59:06 +0000] information/cli: Loading configuration file(s). [2019-05-09 04:59:06 +0000] warning/Value for constant ‘TicketSalt’ was modified. This behaviour is deprecated. Location: in /etc/icinga2/constants.conf: 29:1-29:53 /etc/icinga2/constants.conf(29): const TicketSalt = “1aa128c057269076519df3bc7695e12b” ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : [2019-05-09 04:59:06 +0000] information/ConfigItem: Committing config item(s). [2019-05-09 04:59:06 +0000] information/ApiListener: My API identity: icinga.company.build [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘System Load’ (in /etc/icinga2/zones.d/master/services.conf: 8:1-8:27) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘Process’ (in /etc/icinga2/zones.d/master/services.conf: 15:1-15:23) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘Users’ (in /etc/icinga2/zones.d/master/services.conf: 22:1-22:21) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘Disk’ (in /etc/icinga2/zones.d/master/services.conf: 29:1-29:20) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘’ (in /etc/icinga2/zones.d/master/services.conf: 36:1-36:59) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘SWAP’ (in /etc/icinga2/zones.d/master/services.conf: 44:1-44:20) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘FTP Service’ (in /etc/icinga2/zones.d/master/services.conf: 59:1-59:27) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘Icinga2 Service’ (in /etc/icinga2/zones.d/master/services.conf: 67:1-67:31) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘’ (in /etc/icinga2/zones.d/master/services.conf: 74:1-74:71) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] warning/ApplyRule: Apply rule ‘’ (in /etc/icinga2/zones.d/master/services.conf: 82:1-82:66) for type ‘Service’ does not match anywhere! [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 16 Services. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 IcingaApplication. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 4 Hosts. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 FileLogger. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 NotificationComponent. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 ApiListener. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 CheckerComponent. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 3 Zones. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 ExternalCommandListener. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 Endpoint. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 ApiUser. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 1 IdoMysqlConnection. [2019-05-09 04:59:06 +0000] information/ConfigItem: Instantiated 215 CheckCommands. [2019-05-09 04:59:06 +0000] information/ScriptGlobal: Dumping variables to file ‘/var/cache/icinga2/icinga2.vars’ [2019-05-09 04:59:06 +0000] information/cli: Finished validating the configuration file(s).

services.conf :

`apply Service "NS-Client-Version" {
check_command = "nscp"
vars.nscp_variable = "CLIENTVERSION"
vars.nscp_password = "company1234"
vars.nscp_showall = true
assign where host.vars.os_type == "windows"
vars.notification["mail"] = { groups = [ "icingaadmins" ] }
}

apply Service "RAM-Usage" {
check_command = "nscp"
vars.nscp_variable = "MEMUSE"
vars.nscp_password = "company1234"
assign where host.vars.os_type == "windows"
vars.nscp_warn = 80
vars.nscp_crit = 90
vars.notification["mail"] = { groups = [ "icingaadmins" ] }
}
`

hosts.conf :

 `object Host "UTIL-SERVER" {
import "windows-host-template"
address = "192.x.x.X"
check_command = "ping"
vars.nscp_port = 12489 //set the port here, so that services don't need it. the command macro resolver detects that automatically.
vars.os_type = "windows"
vars.notification["mail"] = { groups = [ "icingaadmins" ] }
enable_notifications = true

}

object Host "FILE-SERVER" {
import "windows-host-template"
address = "10.0.X.X"
check_command = "ping"
vars.nscp_port = 12489 //set the port here, so that services don't need it. the command macro resolver detects that automatically.
vars.os_type = "windows"
vars.notification["mail"] = { groups = [ "icingaadmins" ] }
}
`

users.conf: `/**

* The example user 'icingaadmin' and the example
* group 'icingaadmins'.
*/

object User "icingaadmin" {
import "generic-user"

display_name = "Icinga 2 Admin"
groups = [ "icingaadmins" ]

email = "[support@mydomain.com](mailto:support@mydomain.com)"
}

object UserGroup "icingaadmins" {
display_name = "Icinga 2 Admin Group"
}
`

notification.conf : `/**

* The example notification apply rules.
* Only applied if host/service objects have
* the custom attribute  `notification`  defined
* and containing  `mail`  as key.
* Check  `hosts.conf`  for an example.
*/

apply Notification "mail-icingaadmin" to Host {
import "mail-host-notification"
user_groups = host.vars.notification.mail.groups
users = host.vars.notification.mail.users

interval = 2h

//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

interval = 2h

//vars.notification_logtosyslog = true

assign where host.vars.notification.mail
}`

Hi,

does this specific host object have any notification objects created from your apply rules? You can check that with icinga2 object list --type Notification --name *hostname*.

Cheers,
Michael

1 Like

Tried above command but the output was empty. also noticed that we cant use generic host template : critical/config: Error: Import references unknown template: ‘generic-host’

We have fixed this: Someone in our team accidentally removed conf.d dir from includes… Thanks

Just a hint: Please tick one answer as solution instead of changing the thread title to “[solved]” :slight_smile:

Done that, Thanks!!!