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:
parent
e7762e4d19
commit
68e44f853e
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user