Hi,
I’m attempting to setup email notifications through Director, unfortunately my configuration doesn’t want to send mail through to our relay.
Icinga2 is sat on Ubuntu. I’ve also installed mailtools/postfix on the same server.
ii libmailutils5:amd64 1:3.4-1
ii mailutils 1:3.4-1
ii mailutils-common 1:3.4-1
ii mime-support
ii postfix
I’ve tested sending via the command line
mail -s "Test Email" emailaddr@mydomain.com < /dev/null
which worked.
I’ve even managed to get email to local mail store on the server, not sure how.
In Director I’ve setup templates for and used Timeperiods, User, and Notifications.
zones.d/director-global/user_templates.conf
template User "MIS User" {
enable_notifications = true
states = [ Critical, Down, OK, Up, Warning ]
types = [
Acknowledgement,
DowntimeEnd,
DowntimeRemoved,
DowntimeStart,
Problem,
Recovery
]
groups = [ "MIS" ]
}
zones.d/cyllene/users.conf
object User "myname" {
display_name = "my name"
email = "email@fqdn. com"
enable_notifications = true
states = [ Critical, Down, OK, Up, Warning ]
types = [
Acknowledgement,
DowntimeEnd,
DowntimeRemoved,
DowntimeStart,
Problem,
Recovery
]
groups = [ "MIS" ]
}
## zones.d/director-global/timeperiod_templates.conf
template TimePeriod "Week Core Hours" {
import "[legacy-timeperiod](https://cyllene.fqdn/icingaweb2/director/timeperiod?name=legacy-timeperiod)"
display_name = "Week Core Hours"
ranges = { "monday, tuesday, wednesday, thursday, friday" = "08:00-18:00" } }
## zones.d/cyllene/notification_templates.conf
template Notification "template name" {
command = "[mail-service-notification](https://cyllene.fqdncom/icingaweb2/director/command?name=mail-service-notification)"
interval = 15s
period = "Week Core"
states = [ Critical, OK, Warning ]
types = [ Acknowledgement, Custom, DowntimeEnd, DowntimeRemoved, DowntimeStart, Problem, Recovery ]
users = [ "myname" ] }
## zones.d/cyllene/notification_apply.conf
apply Notification "Test notification Hosts" to Host {
command = "[mail-service-notification](https://cyllene.fqdn.com/icingaweb2/director/command?name=mail-service-notification)"
interval = 15s
period = "Week Core"
assign where host.enable_notifications != "false"
states = [ Down, Up ]
types = [ Acknowledgement, Custom, Problem, Recovery ]
users = [ "myname" ] }
I’ve enabled debug and can see the following log msg.
[information/Checkable: Checkable 'hostname.fqdn.com' has 1 notification(s). Checking filters for type 'Custom', sends will be logged.
The host has notifications enabled, but nothing is sent.