1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 02:13:44 +01:00

check_uptime updated to support remote hosts via nrpe

This commit is contained in:
Tómas Edwardsson 2010-11-25 23:17:13 +00:00
parent e7762e4d19
commit 68e44f853e

View File

@ -22,7 +22,14 @@
HOSTN="localhost" # By default check localhost
CHECK_COMMAND="uptime" # Default command to check uptime
# We we are not checking localhost, lets get remote uptime via NRPE
if [ "$HOSTN" -ne "localhost" ]; then
export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins
CHECK_COMMAND="check_nrpe -H $HOSTN -c get_uptime"
fi
# Get the uptime, raise error if we are unsuccessful
OUTPUT=`$CHECK_COMMAND`
RESULT=$?
@ -32,6 +39,7 @@ if [ $RESULT -gt 0 ]; then
exit 3
fi
# Parse the output from uptime command
set -- $OUTPUT
if [ $4 == 'min(s),' ]; then
echo "Warning, $HOSTN uptime is $OUTPUT"