diff --git a/check_uptime/trunk/check_uptime.sh b/check_uptime/trunk/check_uptime.sh index 6a1e2d9..36adbd4 100644 --- a/check_uptime/trunk/check_uptime.sh +++ b/check_uptime/trunk/check_uptime.sh @@ -22,6 +22,36 @@ HOSTN="localhost" # By default check localhost CHECK_COMMAND="uptime" # Default command to check uptime +print_help() { + echo "$0 version $VERSION" + echo "This plugin checks uptime of local or remote host" + echo "" + echo "Usage: $0 [-H ]" + echo "" + echo "Example: Check uptime of a remote host" + echo "# $0 -H remotehost -s Enforcing" +} + +# Parse arguments +while [ $# -gt 0 ] +do + case $1 + in + -H) + HOSTN=$2 + shift 2 + ;; + + *) + print_help ; + exit $UNKNOWN + ;; + esac +done + + + + # We we are not checking localhost, lets get remote uptime via NRPE if [ "$HOSTN" != "localhost" ]; then export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins @@ -29,6 +59,9 @@ if [ "$HOSTN" != "localhost" ]; then fi + + + # Get the uptime, raise error if we are unsuccessful OUTPUT=`$CHECK_COMMAND` RESULT=$?