{% if icinga2_incidentio_token is defined and icinga2_incidentio_endpoint_url is defined %} object User "incidentio" { display_name = "incident.io" groups = [ "icingaadmins" ] vars.token = {{ icinga2_incidentio_token | to_json }} vars.endpoint_url = {{ icinga2_incidentio_endpoint_url | to_json }} states = [ OK, Warning, Critical, Unknown, Up, Down ] types = [ Problem, Acknowledgement, Recovery ] } object NotificationCommand "notify-service-by-incidentio" { import "plugin-notification-command" command = [ ConfigDir + "/scripts/incidentio-notification.sh" ] arguments = { "--endpoint-url" = { value = "$user.vars.endpoint_url$" order = 0 } "--token" = { value = "$user.vars.token$" order = 1 } "--title" = { value = "$service.name$ on $host.display_name$ is $service.state$" order = 2 } "--description" = { value = "$service.output$" order = 3 } "--dedup-key" = { value = "service-$host.name$-$service.name$" order = 4 } "--status" = { value = "$notification.type$" order = 5 } "--host" = { value = "$host.name$" order = 6 } "--service" = { value = "$service.name$" order = 7 } } } object NotificationCommand "notify-host-by-incidentio" { import "plugin-notification-command" command = [ ConfigDir + "/scripts/incidentio-notification.sh" ] arguments = { "--endpoint-url" = { value = "$user.vars.endpoint_url$" order = 0 } "--token" = { value = "$user.vars.token$" order = 1 } "--title" = { value = "Host $host.display_name$ is $host.state$" order = 2 } "--description" = { value = "$host.output$" order = 3 } "--dedup-key" = { value = "host-$host.name$" order = 4 } "--status" = { value = "$notification.type$" order = 5 } "--host" = { value = "$host.name$" order = 6 } } } apply Notification "incidentio-service" to Service { command = "notify-service-by-incidentio" states = [ OK, Warning, Critical, Unknown ] types = [ Problem, Acknowledgement, Recovery ] period = "24x7" users = [ "incidentio" ] assign where service.vars.enable_incidentio == true } apply Notification "incidentio-host" to Host { command = "notify-host-by-incidentio" states = [ Up, Down ] types = [ Problem, Acknowledgement, Recovery ] period = "24x7" users = [ "incidentio" ] assign where host.vars.enable_incidentio == true } {% endif %}