So I’m having struggling to get notifications to work and it seems I’m getting strange behavior. I can’t get notifications to send and when using the “send notification” button on the web GUI, it only seems to work with 1 host.
I think I may have confused my self trying to get my head around the issue. I’m hoping someone can help and its just a simple fix.
From the logs when trying to send notifications
Trying to send custom notification with forced button ticked
Checkable: Checking for configured notifications for object 'man-esx-01.domain.com'
Trying to send custom notification with forced button unticked
information/Checkable: Checking for configured notifications for object 'lds-esx-01.domain.com'
Trying to send custom notification with forced button ticked
information/ExternalCommandListener: Executing external command: [1565090368] SEND_CUSTOM_HOST_NOTIFICATION;lds-esx-01.domain.com;2;admin;test
information/Checkable: Checking for configured notifications for object 'lds-esx-01.domain.com'
From objects file
object Host "man-esx-01.domain.com" {
import "generic-host"
address = "man-esx-01.sc.nccgroup.com"
vars.esxi = "esxi"
}
object Host "lds-esx-01.domain.com" {
import "generic-host"
address = "lds-esx-01.domain.com"
vars.esxi = "esxi"
}
icinga2 --version
System information:
Platform: Ubuntu
Platform version: 18.04.2 LTS (Bionic Beaver)
Kernel: Linux
Kernel version: 4.15.0-55-generic
Architecture: x86_64
Build information:
Compiler: GNU 7.4.0
Build host: 8b8700ecb474
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
From notifications.conf, I believe this should send notifications for any host that has an address, we basically want every host being monitored to send notifications
apply Notification "mail-icingaadmin" to Host {
import "mail-host-notification"
user_groups = ["icingaadmins"]
//interval = 2h
//vars.notification_logtosyslog = true
assign where host.address
}
From templates.conf
template Host "generic-host" {
max_check_attempts = 3
check_interval = 1m
retry_interval = 30s
# enable_notifications = true
check_command = "hostalive"
vars.notifaction.mail.groups = ["icingaadmins"]
}
template User "generic-user" {
}
template Notification "mail-host-notification" {
command = "mail-host-notification"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
vars += {
// notification_icingaweb2url = "https://www.example.com/icingaweb2"
// notification_from = "Icinga 2 Host Monitoring <icinga@example.com>"
notification_logtosyslog = false
}
period = "24x7"
}
From users.conf
object User "icingaadmin" {
import "generic-user"
display_name = "Icinga 2 Admin"
groups = [ "icingaadmins" ]
enable_notifications = true
states = [ OK, Warning, Critical ]
types = [ Problem, Recovery ]
email = "dmins@domain.com"
}
object UserGroup "icingaadmins" {
display_name = "Icinga 2 Admin Group"
}