From 18b2ebbcc0a965595a69719e6273a7b08d819676 Mon Sep 17 00:00:00 2001 From: Rico Ullmann Date: Tue, 4 Jan 2022 12:00:15 +0100 Subject: [PATCH] nginx: check http/s connections with monit --- bundles/nginx/metadata.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bundles/nginx/metadata.py b/bundles/nginx/metadata.py index 27a8bdb..1999cab 100644 --- a/bundles/nginx/metadata.py +++ b/bundles/nginx/metadata.py @@ -148,6 +148,33 @@ def monitoring(metadata): }, } +@metadata_reactor.provides( + 'monit/services/nginx/http', +) +def monithttp(metadata): + http = {} + + for vname, vconfig in metadata.get('nginx/vhosts', {}).items(): + domain = vconfig.get('domain', vname) + + if vconfig['ssl']: + scheme = 'https' + else: + scheme = 'http' + + http[domain] = { + 'scheme': scheme, + } + + return { + 'monit': { + 'services': { + 'nginx': { + 'http': http, + }, + }, + }, + } @metadata_reactor.provides( 'firewall/port_rules/80',