I am trying to create a test Apply Rule for my Notification Template, configuration is as follows:
Notification Template:
Apply Rule:
When trying to deplay i receive the following Error for all host that mach the apply rule.:
[2020-10-21 13:55:24 +0200] critical/config: Error: Validation failed for object 'myhost!Test Notification' of type 'Notification'; Attribute 'command': Object 'mail-host-notification' of type 'NotificationCommand' does not exist.
Location: in [stage]/zones.d/myendpoint/notification_templates.conf: 5:5-5:38
[stage]/zones.d/myendpoint/notification_templates.conf(3): begin = 5s
[stage]/zones.d/myendpoint/notification_templates.conf(4): }
[stage]/zones.d/myendpoint/notification_templates.conf(5): command = "mail-host-notification"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stage]/zones.d/myendpoint/notification_templates.conf(6): interval = 0s
[stage]/zones.d/myendpoint/notification_templates.conf(7): states = [ Critical, Down, Unknown, Up ]
I have the mail-host-notification command as an “external command” in director, its config is as follows:
object NotificationCommand "mail-host-notification" {
import "plugin-notification-command"
command = [ "/etc/icinga2/scripts/mail-host-notification.sh" ]
timeout = 1m
arguments += {
"-4" = "$notification_address$"
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
"-d" = {
required = true
value = "$notification_date$"
}
"-f" = {
description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)"
value = "$notification_from$"
}
"-i" = "$notification_icingaweb2url$"
"-l" = {
required = true
value = "$notification_hostname$"
}
"-n" = {
required = true
value = "$notification_hostdisplayname$"
}
"-o" = {
required = true
value = "$notification_hostoutput$"
}
"-r" = {
required = true
value = "$notification_useremail$"
}
"-s" = {
required = true
value = "$notification_hoststate$"
}
"-t" = {
required = true
value = "$notification_type$"
}
"-v" = "$notification_logtosyslog$"
}
vars.notification_address = "$address$"
vars.notification_address6 = "$address6$"
vars.notification_author = "$notification.author$"
vars.notification_comment = "$notification.comment$"
vars.notification_date = "$icinga.long_date_time$"
vars.notification_hostdisplayname = "$host.display_name$"
vars.notification_hostname = "$host.name$"
vars.notification_hostoutput = "$host.output$"
vars.notification_hoststate = "$host.state$"
vars.notification_type = "$notification.type$"
vars.notification_useremail = "$user.email$"
}
If you need any further Information please don’t hesitate to let me know.
Thank you in advance.
(also how do i properly format the cli text?)