diff --git a/bundles/icinga2/files/check_by_sshmon b/bundles/icinga2/files/check_by_sshmon index df553f9..3138c78 100644 --- a/bundles/icinga2/files/check_by_sshmon +++ b/bundles/icinga2/files/check_by_sshmon @@ -18,6 +18,8 @@ fi ssh sshmon@"$SSHMON_HOST" "$SSHMON_COMMAND" +exitcode=$? + if [ "$exitcode" = 124 ] then echo 'check_by_sshmon: Timeout while running check remotely' >&2 diff --git a/bundles/monitored/metadata.py b/bundles/monitored/metadata.py index aaa0a07..d82a949 100644 --- a/bundles/monitored/metadata.py +++ b/bundles/monitored/metadata.py @@ -3,13 +3,30 @@ defaults = { 'services': { 'test': { 'vars.command': '/bin/ls /', - 'check_command': 'sshmon', 'host_name': node.name, }, }, }, } + +@metadata_reactor.provides( + 'monitoring/services', +) +def service_defaults(metadata): + return { + 'monitoring': { + 'services': { + name: { + 'check_command': 'sshmon', + } + for name, conf in metadata.get('monitoring/services').items() + if 'check_command' not in conf + }, + }, + } + + @metadata_reactor.provides( 'users/sshmon/authorized_users' )