bundles/c3voc-addons: add nginx vhost monitoring
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
3b90426b4d
commit
4f62e25d5e
2 changed files with 45 additions and 0 deletions
43
bundles/c3voc-addons/metadata.py
Normal file
43
bundles/c3voc-addons/metadata.py
Normal 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,
|
||||
},
|
||||
},
|
||||
}
|
|
@ -32,6 +32,8 @@ nodes['voc.pretalx'] = {
|
|||
},
|
||||
},
|
||||
'extras': True,
|
||||
'website_check_path': '/orga/login/',
|
||||
'website_check_string': 'Sign in :: pretalx',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue