Commit 55e73422 authored by Christian Tacke's avatar Christian Tacke
Browse files

Refactor commands-xmppnotify.conf.

icinga2 support templates. Use them in
commands-xmppnotify.conf. This makes things a bit more
readable and definitely easier to maintain.
parent f7b9fff1
object NotificationCommand "xmpp-host-notification" {
template NotificationCommand "xmpp-notification-base" {
command = [ ConfigDir + "/scripts/xmppnotify.py" ]
arguments += {
"-4" = {
required = true
value = "$notification_address$"
}
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
......@@ -22,18 +18,10 @@ object NotificationCommand "xmpp-host-notification" {
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$"
......@@ -49,53 +37,51 @@ object NotificationCommand "xmpp-host-notification" {
notification_date = "$icinga.long_date_time$"
notification_hostname = "$host.name$"
notification_hostdisplayname = "$host.display_name$"
notification_hostoutput = "$host.output$"
notification_hoststate = "$host.state$"
notification_useremail = "$user.vars.xmpp$"
}
}
object NotificationCommand "xmpp-service-notification" {
command = [ ConfigDir + "/scripts/xmppnotify.py" ]
object NotificationCommand "xmpp-host-notification" {
import "xmpp-notification-base"
arguments += {
"-4" = "$notification_address$"
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
"-d" = {
"-4" = {
required = true
value = "$notification_date$"
value = "$notification_address$"
}
"-e" = {
"-o" = {
required = true
value = "$notification_servicename$"
value = "$notification_hostoutput$"
}
"-i" = "$notification_icingaweb2url$"
"-l" = {
"-s" = {
required = true
value = "$notification_hostname$"
value = "$notification_hoststate$"
}
"-n" = {
}
vars += {
notification_hostoutput = "$host.output$"
notification_hoststate = "$host.state$"
}
}
object NotificationCommand "xmpp-service-notification" {
import "xmpp-notification-base"
arguments += {
"-4" = "$notification_address$"
"-e" = {
required = true
value = "$notification_hostdisplayname$"
value = "$notification_servicename$"
}
"-o" = {
required = true
value = "$notification_serviceoutput$"
}
"-r" = {
required = true
value = "$notification_useremail$"
}
"-s" = {
required = true
value = "$notification_servicestate$"
}
"-t" = {
required = true
value = "$notification_type$"
}
"-u" = {
required = true
value = "$notification_servicedisplayname$"
......@@ -103,18 +89,9 @@ object NotificationCommand "xmpp-service-notification" {
}
vars += {
notification_address = "$address$"
notification_address6 = "$address6$"
notification_author = "$notification.author$"
notification_comment = "$notification.comment$"
notification_type = "$notification.type$"
notification_date = "$icinga.long_date_time$"
notification_hostname = "$host.name$"
notification_hostdisplayname = "$host.display_name$"
notification_servicename = "$service.name$"
notification_serviceoutput = "$service.output$"
notification_servicestate = "$service.state$"
notification_useremail = "$user.vars.xmpp$"
notification_servicedisplayname = "$service.display_name$"
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment