bundles/icinga2: set some notification options for checks

This commit is contained in:
Franzi 2020-11-22 08:24:44 +01:00
parent b114ba3ff8
commit 4a57926577
Signed by: kunsi
GPG key ID: 12E3D2136B818350
10 changed files with 27 additions and 9 deletions

View file

@ -13,3 +13,15 @@ object ServiceGroup "bundle-${bundle}" {
assign where service.vars.bundle == "${bundle}"
}
% endfor
object ServiceGroup "checks_with_mail" {
display_name = "Checks which send E-Mails"
assign where service.vars.notification.mail == true
}
object ServiceGroup "checks_with_sms" {
display_name = "Checks which send SMS"
assign where service.vars.notification.sms == true
}

View file

@ -9,6 +9,8 @@ object Host "${monitored_node.name}" {
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
vars.location = "${monitored_node.metadata.get('location', 'unknown')}"
vars.bw_groups = [ "${'", "'.join(sorted({group.name for group in monitored_node.groups}))}" ]
vars.notification.sms = ${str(monitored_node.metadata.get('icinga_options', {}).get('vars.notification.sms', True)).lower()}
vars.notification.mail = true
}
% endfor

View file

@ -7,9 +7,6 @@ template Host "generic-host" {
enable_event_handler = true
enable_flapping = false
enable_perfdata = false
vars.notification.sms = true
vars.notification_type = "sms"
}
template Host "host-active" {
@ -36,7 +33,6 @@ template Service "generic-service" {
max_check_attempts = 4
check_interval = 5m
retry_interval = 2m
vars.notification.sms = true
enable_notifications = true
enable_event_handler = true
enable_flapping = false
@ -63,8 +59,6 @@ template Notification "host-notification" {
types = [ Problem, Recovery, Custom ]
user_groups = [ "on-call_sms" ]
period = host.vars.period
vars.notification_type = "sms"
}
template Notification "service-notification" {
@ -73,8 +67,6 @@ template Notification "service-notification" {
types = [ Problem, Recovery, Custom ]
user_groups = [ "on-call_sms" ]
vars.notification_type = "sms"
if(service.vars.period) {
period = service.vars.period
} else {