diff --git a/bundles/c3voc-addons/metadata.py b/bundles/c3voc-addons/metadata.py new file mode 100644 index 0000000..279cdaf --- /dev/null +++ b/bundles/c3voc-addons/metadata.py @@ -0,0 +1,43 @@ +defaults = { + 'icinga2_api': { + 'nginx': { + 'services': { + 'NGINX PROCESS': { + 'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_systemd_unit nginx', + }, + }, + }, + }, +} + + +@metadata_reactor.provides( + 'icinga2_api/nginx/services', +) +def monitoring(metadata): + services = {} + + for vname, vconfig in metadata.get('nginx/vhosts', {}).items(): + domain = vconfig.get('domain', vname) + + if 'website_check_path' in vconfig and 'website_check_string' in vconfig: + services['NGINX VHOST {} CONTENT'.format(vname)] = { + 'check_command': 'check_http_wget', + 'vars.http_wget_contains': vconfig['website_check_string'], + 'vars.http_wget_url': 'https://{}{}'.format(domain, vconfig['website_check_path']), + } + + if vconfig.get('check_ssl', True): + services['NGINX VHOST {} CERTIFICATE'.format(vname)] = { + 'check_command': 'check_https_cert_at_url', + 'vars.domain': domain, + 'vars.notification.mail': True, + } + + return { + 'icinga2_api': { + 'nginx': { + 'services': services, + }, + }, + } diff --git a/nodes/voc/pretalx.py b/nodes/voc/pretalx.py index 84d180b..49100ef 100644 --- a/nodes/voc/pretalx.py +++ b/nodes/voc/pretalx.py @@ -32,6 +32,8 @@ nodes['voc.pretalx'] = { }, }, 'extras': True, + 'website_check_path': '/orga/login/', + 'website_check_string': 'Sign in :: pretalx', }, }, },