I have two difference notification email scripts, one long (typical
format) and one short (suitable for SMS). I'd like to use the same
NotificationCommand for both as the same info gets passed to both, I
just need to select the correct script when called. I'm attempting to do
this by setting a custom var in the Notification and then selecting on
that in an if statement in the NotificationCommand. I think I have it
set up correctly, but it doesn't work. The long form is always selected.
This is what I have:
apply Notification "mail-admins-short" to Host {
import "mail-host-notification"
user_groups = [ "admins-sms" ]
vars.short = true
assign where host.vars.notification.mail
}
object NotificationCommand "mail-host-notification" {
import "plugin-notification-command"
var mailscript
log("mail-host-notification, value of vars.short: " + vars.short)
if (vars.short) {
mailscript = "mail-host-notification-short.sh"
} else {
mailscript = "mail-host-notification.sh"
}
command = [ SysconfDir + "/icinga2/scripts/" + mailscript ]
env = {
<---SNIP--->
}
}
Am I missing something? If I can get this to work, I'd like to also use
the same NotificationCommand and be able to select for Host and Service,
instead of having two separate ones for that purpose, as well.
As a side note, the log() doesn't seem to be reporting anything. I've
looked in the syslog and the icinga log and not seeing it.
Suggestions are welcome.
Thanks.
Seth
--
Seth Galitzer
Systems Coordinator
Computing and Information Sciences
Kansas State University
http://www.cis.ksu.edu/~sgsax
[email protected]
785-532-7790
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users