bundles/icinga2: set some notification options for checks
This commit is contained in:
parent
b114ba3ff8
commit
4a57926577
10 changed files with 27 additions and 9 deletions
|
@ -13,3 +13,15 @@ object ServiceGroup "bundle-${bundle}" {
|
||||||
assign where service.vars.bundle == "${bundle}"
|
assign where service.vars.bundle == "${bundle}"
|
||||||
}
|
}
|
||||||
% endfor
|
% 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
|
||||||
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ object Host "${monitored_node.name}" {
|
||||||
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
|
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
|
||||||
vars.location = "${monitored_node.metadata.get('location', 'unknown')}"
|
vars.location = "${monitored_node.metadata.get('location', 'unknown')}"
|
||||||
vars.bw_groups = [ "${'", "'.join(sorted({group.name for group in monitored_node.groups}))}" ]
|
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
|
% endfor
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,6 @@ template Host "generic-host" {
|
||||||
enable_event_handler = true
|
enable_event_handler = true
|
||||||
enable_flapping = false
|
enable_flapping = false
|
||||||
enable_perfdata = false
|
enable_perfdata = false
|
||||||
vars.notification.sms = true
|
|
||||||
vars.notification_type = "sms"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template Host "host-active" {
|
template Host "host-active" {
|
||||||
|
@ -36,7 +33,6 @@ template Service "generic-service" {
|
||||||
max_check_attempts = 4
|
max_check_attempts = 4
|
||||||
check_interval = 5m
|
check_interval = 5m
|
||||||
retry_interval = 2m
|
retry_interval = 2m
|
||||||
vars.notification.sms = true
|
|
||||||
enable_notifications = true
|
enable_notifications = true
|
||||||
enable_event_handler = true
|
enable_event_handler = true
|
||||||
enable_flapping = false
|
enable_flapping = false
|
||||||
|
@ -63,8 +59,6 @@ template Notification "host-notification" {
|
||||||
types = [ Problem, Recovery, Custom ]
|
types = [ Problem, Recovery, Custom ]
|
||||||
user_groups = [ "on-call_sms" ]
|
user_groups = [ "on-call_sms" ]
|
||||||
period = host.vars.period
|
period = host.vars.period
|
||||||
|
|
||||||
vars.notification_type = "sms"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template Notification "service-notification" {
|
template Notification "service-notification" {
|
||||||
|
@ -73,8 +67,6 @@ template Notification "service-notification" {
|
||||||
types = [ Problem, Recovery, Custom ]
|
types = [ Problem, Recovery, Custom ]
|
||||||
user_groups = [ "on-call_sms" ]
|
user_groups = [ "on-call_sms" ]
|
||||||
|
|
||||||
vars.notification_type = "sms"
|
|
||||||
|
|
||||||
if(service.vars.period) {
|
if(service.vars.period) {
|
||||||
period = service.vars.period
|
period = service.vars.period
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -106,12 +106,14 @@ def monitoring(metadata):
|
||||||
'check_command': 'check_http_wget',
|
'check_command': 'check_http_wget',
|
||||||
'vars.http_wget_contains': vconfig['website_check_string'],
|
'vars.http_wget_contains': vconfig['website_check_string'],
|
||||||
'vars.http_wget_url': '{}://{}{}'.format(scheme, domain, vconfig['website_check_path']),
|
'vars.http_wget_url': '{}://{}{}'.format(scheme, domain, vconfig['website_check_path']),
|
||||||
|
'vars.notification.sms': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
if vconfig.get('check_ssl', False):
|
if vconfig.get('check_ssl', False):
|
||||||
services['NGINX VHOST {} CERTIFICATE'.format(vname)] = {
|
services['NGINX VHOST {} CERTIFICATE'.format(vname)] = {
|
||||||
'check_command': 'check_vhost_https_cert_at_url',
|
'check_command': 'check_vhost_https_cert_at_url',
|
||||||
'vars.domain': domain,
|
'vars.domain': domain,
|
||||||
|
'vars.notification.mail': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
max_connections = metadata.get('nginx/worker_connections') * metadata.get('nginx/worker_processes')
|
max_connections = metadata.get('nginx/worker_connections') * metadata.get('nginx/worker_processes')
|
||||||
|
|
|
@ -28,6 +28,7 @@ if node.has_bundle('postfixadmin'):
|
||||||
defaults['icinga2_api']['postfix']['services'].update({
|
defaults['icinga2_api']['postfix']['services'].update({
|
||||||
'SMTP CONNECT': {
|
'SMTP CONNECT': {
|
||||||
'check_command': 'check_smtp',
|
'check_command': 'check_smtp',
|
||||||
|
'vars.notification.sms': True,
|
||||||
},
|
},
|
||||||
'SMTP SUBMISSION CONNECT': {
|
'SMTP SUBMISSION CONNECT': {
|
||||||
'check_command': 'check_smtp',
|
'check_command': 'check_smtp',
|
||||||
|
|
|
@ -14,6 +14,7 @@ defaults = {
|
||||||
'services': {
|
'services': {
|
||||||
'POWERDNS PROCESS': {
|
'POWERDNS PROCESS': {
|
||||||
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C pdns_server -c 1:',
|
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C pdns_server -c 1:',
|
||||||
|
'vars.notification.mail': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -96,6 +96,7 @@ def default_checks(metadata):
|
||||||
'-A -I "^/dev$" -I "^/run" -I "^/sys" -i "/sys/kernel/debug/tracing" '
|
'-A -I "^/dev$" -I "^/run" -I "^/sys" -i "/sys/kernel/debug/tracing" '
|
||||||
f'{disk_space_ignore_patterns_string}',
|
f'{disk_space_ignore_patterns_string}',
|
||||||
),
|
),
|
||||||
|
'vars.notification.mail': True,
|
||||||
},
|
},
|
||||||
'MOUNTS': {
|
'MOUNTS': {
|
||||||
'command_on_monitored_host': f'sudo /usr/local/share/icinga/plugins/check_mounts {mounts_options}',
|
'command_on_monitored_host': f'sudo /usr/local/share/icinga/plugins/check_mounts {mounts_options}',
|
||||||
|
|
|
@ -12,6 +12,7 @@ defaults = {
|
||||||
'services': {
|
'services': {
|
||||||
'QEMU VM STATUS': {
|
'QEMU VM STATUS': {
|
||||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_vm_status',
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_vm_status',
|
||||||
|
'vars.notification.mail': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -76,6 +76,7 @@ if node.has_bundle('sshmon'):
|
||||||
},
|
},
|
||||||
'ZFS MOUNTED VOLUMES': {
|
'ZFS MOUNTED VOLUMES': {
|
||||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_volumes',
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_volumes',
|
||||||
|
'vars.notification.mail': True,
|
||||||
},
|
},
|
||||||
'ZFS OLD SNAPSHOTS': {
|
'ZFS OLD SNAPSHOTS': {
|
||||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_old_snapshots',
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_old_snapshots',
|
||||||
|
@ -147,10 +148,12 @@ def monitoring(metadata):
|
||||||
for poolname, pool_options in metadata.get('zfs/pools').items():
|
for poolname, pool_options in metadata.get('zfs/pools').items():
|
||||||
services['ZFS ZPOOL ONLINE {}'.format(poolname)] = {
|
services['ZFS ZPOOL ONLINE {}'.format(poolname)] = {
|
||||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zpool_online {}'.format(poolname),
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zpool_online {}'.format(poolname),
|
||||||
|
'vars.notification.mail': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
services['ZFS ZPOOL SPACE ' + poolname] = {
|
services['ZFS ZPOOL SPACE ' + poolname] = {
|
||||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zpool_space {} 90'.format(poolname)
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zpool_space {} 90'.format(poolname),
|
||||||
|
'vars.notification.mail': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -10,6 +10,9 @@ nodes['htz-cloud.sewfile'] = {
|
||||||
'webserver',
|
'webserver',
|
||||||
},
|
},
|
||||||
'metadata': {
|
'metadata': {
|
||||||
|
'icinga_options': {
|
||||||
|
'vars.notification.sms': False,
|
||||||
|
},
|
||||||
'interfaces': {
|
'interfaces': {
|
||||||
'eth0': {
|
'eth0': {
|
||||||
'ips': {
|
'ips': {
|
||||||
|
|
Loading…
Reference in a new issue