From 6cdc371616cb3636f93952a3e90104b6d4052b57 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Thu, 18 Aug 2022 01:53:20 +0200 Subject: [PATCH] wip --- bundles/monitored/metadata.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bundles/monitored/metadata.py b/bundles/monitored/metadata.py index d82a949..e2cccd9 100644 --- a/bundles/monitored/metadata.py +++ b/bundles/monitored/metadata.py @@ -3,7 +3,6 @@ defaults = { 'services': { 'test': { 'vars.command': '/bin/ls /', - 'host_name': node.name, }, }, }, @@ -13,20 +12,26 @@ defaults = { @metadata_reactor.provides( 'monitoring/services', ) -def service_defaults(metadata): +def default_check_command(metadata): + services = {} + + for name, conf in metadata.get('monitoring/services').items(): + services[name] = {} + + if 'host_name' not in conf: + services[name]['host_name'] = node.name + + if 'check_command' not in conf: + services[name]['check_command'] = 'sshmon' + return { 'monitoring': { - 'services': { - name: { - 'check_command': 'sshmon', - } - for name, conf in metadata.get('monitoring/services').items() - if 'check_command' not in conf - }, + 'services': services, }, } + @metadata_reactor.provides( 'users/sshmon/authorized_users' )