Created
July 29, 2015 22:13
-
-
Save rakesh-patnaik/0ef7f49862c1872c6496 to your computer and use it in GitHub Desktop.
composite nagios check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
nrpe="/usr/local/nagios/libexec/check_nrpe" | |
hostname="127.0.0.1" | |
check_one="$1" | |
check_two="$2" | |
$nrpe -H $hostname -c $check_one | |
return_one=$? | |
$nrpe -H $hostname -c $check_two | |
return_two=$? | |
output=3 | |
if [ "$return_one" -ge 0 ] && [ "$return_two" -ge 0 ]; then | |
output=0 | |
status="OK" | |
fi | |
if [ "$return_one" -ge 1 ] && [ "$return_two" -ge 1 ]; then | |
output=1 | |
status="WARNING" | |
fi | |
if [ "$return_one" -eq 2 ] && [ "$return_two" -eq 2 ]; then | |
output=2 | |
status="CRITICAL" | |
fi | |
echo $status | |
exit $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment