Hi,

sorry for the delay ;-)

Am 15.05.2015 um 16:46 schrieb Seth Galitzer:
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.

See my reply on the forums.

http://www.monitoring-portal.org/wbb/index.php?page=Thread&postID=216660#post216660

Kind regards,
Michael

-- 
Michael Friedrich, DI (FH)
Application Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected]

** OSBConf 2015 - September - osbconf.org **
** OSMC 2015 - November - netways.de/osmc **
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to