Hi!
By testing I meant two things, running Spiller’s host-by-mail script from the cli with manually added parameters, that manages to send out a test email. Also when on the web interface if I select a host and click “Notification” and send a custom host notification that also works. For now, all I want is to get an email if a host goes down. I have a host added for testing that I can simulate problems with. If I could get that working I could probably figure out the rest…
Ok so from the top:
I have a notification template called “host_notify_template”, looks like this:
zones.d/myserver.local/notification_templates.conf
template Notification “host_notify_template” {
command = “host-by-mail”
period = “always”
states = [ Down, Up ]
types = [ Acknowledgement, Custom, Problem, Recovery ]
users = [ “myuser” ]
}
Then I have a notification with that template that looks like this (I’m not sure about the assign rule here tbh):
zones.d/myserver.local/notification_apply.conf
apply Notification “host-notification” to Host {
import “host_notify_template”
assign where host.enable_notifications == "true"
users = [ "myuser" ]
}
These call for a command called “host-by-mail”. That looks like this:
zones.d/icinga.srvs.blkfpark.local/commands.conf
object NotificationCommand “host-by-mail” {
import “plugin-notification-command”
command = [ “/etc/icinga2/scripts/host-by-mail.sh” ]
arguments += {
“-4” = “$address$”
“-6” = “$address6$”
“-d” = “$icinga.long_date_time$”
“-l” = “$host.name$”
“-n” = “$host.display_name$”
“-o” = “$host.output$”
“-r” = “$user.email$”
“-s” = “$host.state$”
“-t” = “$notification.type$”
}
}
Versions:
icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.4-1)
icininga web2 version: 2.6.2
icinga director version: 1.6.2
What else do you need in regard of config files?
Also regarding logs, when I make the test host unavailable the notification doesn’t fire at all as far as I can tell.
Thanks!