bundles/nginx/metadata.pybasic http check

This commit is contained in:
mwiegand 2022-09-05 13:48:54 +02:00
parent d8f0d49a64
commit 1e2e63405a
2 changed files with 23 additions and 4 deletions

View file

@ -24,6 +24,7 @@ def nginx(metadata):
'context': {
'root': f"/var/www/{metadata.get('mailserver/autoconfig_hostname')}",
},
'check_path': '/mail/config-v1.1.xml',
},
},
},

View file

@ -1,5 +1,7 @@
from shlex import quote
from ipaddress import ip_interface
defaults = {
'apt': {
'packages': {
@ -111,3 +113,19 @@ def letsencrypt(metadata):
},
},
}
@metadata_reactor.provides(
'monitoring/services',
)
def monitoring(metadata):
return {
'monitoring': {
'services': {
f'HTTP {hostname}': {
'vars.command': f"""/usr/bin/curl {quote(hostname + vhost.get('check_path', ''))} -IL --fail"""
}
for hostname, vhost in metadata.get('nginx/vhosts').items()
},
},
}