mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-22 02:13:44 +01:00
check_uptime added feature to monitor remote host via nrpe
This commit is contained in:
parent
7cd21e9380
commit
432227fdb0
@ -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 <host>]"
|
||||
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=$?
|
||||
|
Loading…
Reference in New Issue
Block a user