summaryrefslogtreecommitdiffstats
path: root/zones.d/master/notification-commands.conf
diff options
context:
space:
mode:
Diffstat (limited to 'zones.d/master/notification-commands.conf')
-rw-r--r--zones.d/master/notification-commands.conf201
1 files changed, 201 insertions, 0 deletions
diff --git a/zones.d/master/notification-commands.conf b/zones.d/master/notification-commands.conf
new file mode 100644
index 0000000..57b15fe
--- /dev/null
+++ b/zones.d/master/notification-commands.conf
@@ -0,0 +1,201 @@
+template NotificationCommand "generic-notification" {
+ vars += {
+ notification_address = "$address$"
+ notification_address6 = "$address6$"
+ notification_author = "$notification.author$"
+ notification_comment = "$notification.comment$"
+ notification_date = "$icinga.long_date_time$"
+ notification_icingaweb2url = IcingaWebUrl
+ notification_hostdisplayname = "$host.display_name$"
+ notification_hostname = "$host.name$"
+ notification_type = "$notification.type$"
+ }
+}
+
+template NotificationCommand "generic-host-notification" {
+ import "generic-notification"
+ vars += {
+ notification_hostoutput = "$host.output$"
+ notification_hoststate = "$host.state$"
+ }
+}
+
+template NotificationCommand "generic-service-notification" {
+ import "generic-notification"
+ vars += {
+ notification_servicedisplayname = "$service.display_name$"
+ notification_servicename = "$service.name$"
+ notification_serviceoutput = "$service.output$"
+ notification_servicestate = "$service.state$"
+ }
+}
+
+object NotificationCommand "mail-host-notification" {
+ import "generic-host-notification"
+
+ command = [ ConfigDir + "/scripts/mail-host-notification.sh" ]
+
+ arguments += {
+ "-4" = "$notification_address$"
+ "-6" = "$notification_address6$"
+ "-b" = "$notification_author$"
+ "-c" = "$notification_comment$"
+ "-d" = {
+ required = true
+ value = "$notification_date$"
+ }
+ "-f" = {
+ value = "$notification_from$"
+ description = "Set from address."
+ }
+ "-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_useremail = "$user.email$"
+ }
+}
+
+object NotificationCommand "mail-service-notification" {
+ import "generic-service-notification"
+
+ command = [ ConfigDir + "/scripts/mail-service-notification.sh" ]
+
+ arguments += {
+ "-4" = "$notification_address$"
+ "-6" = "$notification_address6$"
+ "-b" = "$notification_author$"
+ "-c" = "$notification_comment$"
+ "-d" = {
+ required = true
+ value = "$notification_date$"
+ }
+ "-e" = {
+ required = true
+ value = "$notification_servicename$"
+ }
+ "-f" = {
+ value = "$notification_from$"
+ description = "Set from address."
+ }
+ "-i" = "$notification_icingaweb2url$"
+ "-l" = {
+ required = true
+ value = "$notification_hostname$"
+ }
+ "-n" = {
+ required = true
+ value = "$notification_hostdisplayname$"
+ }
+ "-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$"
+ }
+ "-v" = "$notification_logtosyslog$"
+ }
+
+ vars += {
+ notification_useremail = "$user.email$"
+ }
+}
+
+object NotificationCommand "telegram-host-notification" {
+ import "generic-host-notification"
+
+ command = [ ConfigDir + "/scripts/telegram-host-notification.sh" ]
+
+ env = {
+ ADDRESS = "$notification_address$"
+ ADDRESS6 = "$notification_address6$"
+ AUTHOR = "$notification_author$"
+ COMMENT = "$notification_comment$"
+ DATE = "$notification_date$"
+ ICINGAWEB2URL = "$notification_icingaweb2url$"
+ HOSTDISPLAYNAME = "$notification_hostdisplayname$"
+ HOSTNAME = "$notification_hostname$"
+ TYPE = "$notification_type$"
+
+ HOSTOUTPUT = "$notification_hostoutput$"
+ HOSTSTATE = "$notification_hoststate$"
+
+ USERCHATID = "$notification_userchatid$"
+ TOKEN = "$notification_token$"
+ }
+
+ vars += {
+ notification_userchatid = "$user.vars.telegram$"
+ notification_token = TelegramBotToken
+ }
+}
+
+object NotificationCommand "telegram-service-notification" {
+ import "generic-service-notification"
+
+ command = [ ConfigDir + "/scripts/telegram-service-notification.sh" ]
+
+ env = {
+ ADDRESS = "$notification_address$"
+ ADDRESS6 = "$notification_address6$"
+ AUTHOR = "$notification_author$"
+ COMMENT = "$notification_comment$"
+ DATE = "$notification_date$"
+ ICINGAWEB2URL = "$notification_icingaweb2url$"
+ HOSTDISPLAYNAME = "$notification_hostdisplayname$"
+ HOSTNAME = "$notification_hostname$"
+ TYPE = "$notification_type$"
+
+ SERVICEDISPLAYNAME = "$notification_servicedisplayname$"
+ SERVICENAME = "$notification_servicename$"
+ SERVICEOUTPUT = "$notification_serviceoutput$"
+ SERVICESTATE = "$notification_servicestate$"
+
+ USERCHATID = "$notification_userchatid$"
+ TOKEN = "$notification_token$"
+ }
+
+ vars += {
+ notification_userchatid = "$user.vars.telegram$"
+ notification_token = TelegramBotToken
+ }
+}