From 9b9f443b9bd9dc8603110fafaa3e3a433e279052 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Thu, 18 Aug 2022 02:00:30 +0200 Subject: [PATCH] wip --- bundles/icinga2/files/check_by_sshmon | 2 +- bundles/monitored/metadata.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bundles/icinga2/files/check_by_sshmon b/bundles/icinga2/files/check_by_sshmon index 3138c78..c9a31df 100644 --- a/bundles/icinga2/files/check_by_sshmon +++ b/bundles/icinga2/files/check_by_sshmon @@ -16,7 +16,7 @@ then exit $UNKNOWN fi -ssh sshmon@"$SSHMON_HOST" "$SSHMON_COMMAND" +ssh sshmon@"$SSHMON_HOST" "sudo $SSHMON_COMMAND" exitcode=$? diff --git a/bundles/monitored/metadata.py b/bundles/monitored/metadata.py index e2cccd9..f6d4cb7 100644 --- a/bundles/monitored/metadata.py +++ b/bundles/monitored/metadata.py @@ -33,7 +33,8 @@ def default_check_command(metadata): @metadata_reactor.provides( - 'users/sshmon/authorized_users' + 'users/sshmon/authorized_users', + 'sudoers/sshmon', ) def user(metadata): return { @@ -44,4 +45,11 @@ def user(metadata): } }, }, + 'sudoers': { + 'sshmon': { + conf['vars.command'] + for conf in metadata.get('monitoring/services').values() + if conf['check_command'] == 'sshmon' + }, + }, }