bundles/icinga2: add servicegroup for every service which has checks
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit

This commit is contained in:
Franzi 2020-11-21 23:04:15 +01:00
parent 0bc4b5439c
commit d428572461
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 23 additions and 10 deletions

View file

@ -5,3 +5,11 @@ object HostGroup "group-${group.name}" {
assign where "${group.name}" in host.vars.bw_groups assign where "${group.name}" in host.vars.bw_groups
} }
% endfor % endfor
% for bundle in sorted(bundles):
object ServiceGroup "bundle-${bundle}" {
display_name = "bw bundle ${bundle}"
assign where service.vars.bundle == "${bundle}"
}
% endfor

View file

@ -14,6 +14,7 @@ object Service "${service}" {
% endif % endif
% endif % endif
% endfor % endfor
vars.bundle = "${bundle_name}"
vars.notification.sms = ${str(config.get('vars.notification.sms', False)).lower()} vars.notification.sms = ${str(config.get('vars.notification.sms', False)).lower()}
} }
% endfor % endfor

View file

@ -129,16 +129,6 @@ files = {
'svc_systemd:icinga2:restart', 'svc_systemd:icinga2:restart',
}, },
}, },
'/etc/icinga2/conf.d/groups.conf': {
'source': 'icinga2/groups.conf',
'content_type': 'mako',
'needs': {
'pkg_apt:icinga2',
},
'triggers': {
'svc_systemd:icinga2:restart',
},
},
'/etc/icinga2/conf.d/templates.conf': { '/etc/icinga2/conf.d/templates.conf': {
'source': 'icinga2/templates.conf', 'source': 'icinga2/templates.conf',
'needs': { 'needs': {
@ -261,6 +251,7 @@ for bundle, metadata in bundle_metadata.items():
'source': 'icinga2/services_template.conf', 'source': 'icinga2/services_template.conf',
'content_type': 'mako', 'content_type': 'mako',
'context': { 'context': {
'bundle_name': bundle,
'bundle_metadata': metadata['services'], 'bundle_metadata': metadata['services'],
}, },
'owner': 'nagios', 'owner': 'nagios',
@ -285,3 +276,16 @@ files['/etc/icinga2/conf.d/hosts.conf'] = {
'svc_systemd:icinga2:restart', 'svc_systemd:icinga2:restart',
}, },
} }
files['/etc/icinga2/conf.d/groups.conf'] = {
'source': 'icinga2/groups.conf',
'content_type': 'mako',
'context': {
'bundles': bundle_metadata.keys(),
},
'needs': {
'pkg_apt:icinga2',
},
'triggers': {
'svc_systemd:icinga2:restart',
},
}