bundles/c3voc-addons: add nginx vhost monitoring
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-01-17 08:07:21 +01:00
parent 3b90426b4d
commit 4f62e25d5e
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 45 additions and 0 deletions

View file

@ -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,
},
},
}

View file

@ -32,6 +32,8 @@ nodes['voc.pretalx'] = {
}, },
}, },
'extras': True, 'extras': True,
'website_check_path': '/orga/login/',
'website_check_string': 'Sign in :: pretalx',
}, },
}, },
}, },