#!/bin/sh UNKNOWN=3 if [ -z "$SSHMON_COMMAND" ] then echo 'check_by_sshmon: Env SSHMON_COMMAND missing' >&2 exit $UNKNOWN elif [ -z "$SSHMON_HOST" ] then echo 'check_by_sshmon: Env SSHMON_HOST missing' >&2 exit $UNKNOWN fi if [ -z "$SSHMON_SUDO" ] then PREFIX="" else PREFIX="sudo " fi ssh sshmon@"$SSHMON_HOST" "$PREFIX$SSHMON_COMMAND" exitcode=$? if [ "$exitcode" = 124 ] then echo 'check_by_sshmon: Timeout while running check remotely' >&2 exit $UNKNOWN elif [ "$exitcode" = 255 ] then echo 'check_by_sshmon: SSH error' >&2 exit $UNKNOWN else exit $exitcode fi