# Aufruf in .ssh/authoried_keys für check_by_ssh:
# from="uebelhacker.de",command="/usr/local/bin/nagios-ssh-wrapper-script.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-rsa AAA...

basename=`basename $0`
myexittrap() {
    echo "WARNING ${basename}: SIG received -- exiting"
    exit $1
}

trap 'myexittrap 1' SIGHUP SIGINT SIGQUIT SIGTRAP SIGKILL SIGUSR1 SIGABRT SIGBUS SIGPIPE SIGTERM

if [ -z "$SSH_ORIGINAL_COMMAND" ]
then    echo "ERROR ${basename}: no option, no argument, nothing to do"
	exit 1
fi

case "$SSH_ORIGINAL_COMMAND" in
    check_myprocess)        /user/local/bin/check_processes.sh -p myprocess
                            exit $?
                            ;;
    check_fan)              /usr/local/bin/check_ipmi_sensor -H localhost -T Fan
                            exit $?
                            ;;
    *)                      echo "ERROR ${basename}: remote command not defined \"$SSH_ORIGINAL_COMMAND\""
                            exit 2
                            ;;
esac



