bundles/icinga2: send notifications
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
This commit is contained in:
parent
d26b8ade45
commit
15826c73b0
5 changed files with 283 additions and 1 deletions
74
bundles/icinga2/files/icinga2/notification_commands.conf
Normal file
74
bundles/icinga2/files/icinga2/notification_commands.conf
Normal file
|
@ -0,0 +1,74 @@
|
|||
object NotificationCommand "send-host-notification" {
|
||||
import "plugin-notification-command"
|
||||
|
||||
command = [ ConfigDir + "/scripts/icinga_notification_wrapper" ]
|
||||
|
||||
arguments = {
|
||||
"--mail" = {
|
||||
set_if = {{
|
||||
host_vars = host.vars
|
||||
if (host_vars.notification.mail == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.email$"
|
||||
}
|
||||
"--sms" = {
|
||||
set_if = {{
|
||||
host_vars = host.vars
|
||||
if (host_vars.notification.sms == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.vars.mobile$"
|
||||
}
|
||||
"--host_name" = "$host.display_name$"
|
||||
"--state" = "$host.state$"
|
||||
"--output" = "$host.output$"
|
||||
"--escalation" = {
|
||||
set_if = "$escalation$"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object NotificationCommand "send-service-notification" {
|
||||
import "plugin-notification-command"
|
||||
|
||||
command = [ ConfigDir + "/scripts/icinga_notification_wrapper" ]
|
||||
|
||||
arguments = {
|
||||
"--mail" = {
|
||||
set_if = {{
|
||||
svc_vars = service.vars
|
||||
if (svc_vars.notification.mail == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.email$"
|
||||
}
|
||||
"--sms" = {
|
||||
set_if = {{
|
||||
svc_vars = service.vars
|
||||
if (svc_vars.notification.sms == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.vars.mobile$"
|
||||
}
|
||||
"--host_name" = "$host.display_name$"
|
||||
"--service_name" = "$service.display_name$"
|
||||
"--state" = "$service.state$"
|
||||
"--output" = "$service.output$"
|
||||
"--escalation" = {
|
||||
set_if = "$escalation$"
|
||||
}
|
||||
}
|
||||
}
|
61
bundles/icinga2/files/icinga2/notifications.conf
Normal file
61
bundles/icinga2/files/icinga2/notifications.conf
Normal file
|
@ -0,0 +1,61 @@
|
|||
apply Notification "notify_host-notification" to Host {
|
||||
import "host-notification"
|
||||
interval = 30m
|
||||
|
||||
times = {
|
||||
begin = 1m
|
||||
end = 30m
|
||||
}
|
||||
|
||||
assign where host.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_service-notification" to Service {
|
||||
import "service-notification"
|
||||
interval = 30m
|
||||
|
||||
times = {
|
||||
begin = 1m
|
||||
end = 30m
|
||||
}
|
||||
|
||||
assign where service.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_host-notification-escalation" to Host {
|
||||
import "host-notification"
|
||||
interval = 20m
|
||||
|
||||
times = {
|
||||
begin = 30m
|
||||
}
|
||||
|
||||
vars.escalation = true
|
||||
|
||||
assign where host.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_service-notification-escalation" to Service {
|
||||
import "service-notification"
|
||||
interval = 20m
|
||||
|
||||
times = {
|
||||
begin = 30m
|
||||
}
|
||||
|
||||
vars.escalation = true
|
||||
|
||||
assign where service.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_service-notification-mail" to Service {
|
||||
import "service-notification"
|
||||
interval = 0
|
||||
|
||||
assign where service.vars.notification.mail == true
|
||||
ignore where service.vars.notification.sms == true
|
||||
}
|
|
@ -7,7 +7,7 @@ object User "${username}" {
|
|||
display_name = "${username}"
|
||||
enable_notifications = true
|
||||
period = "24x7"
|
||||
states = [ OK, Critical, Up, Down ]
|
||||
states = [ OK, Warning, Critical, Up, Down ]
|
||||
types = [ Problem, Recovery ]
|
||||
|
||||
% if config['is_admin']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue