Created
June 25, 2013 18:32
-
-
Save hgdeoro/5861046 to your computer and use it in GitHub Desktop.
Wraps original `check_ntp` to check NTP server by hostname instead of IP
This file contains 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 | |
TMP=$(mktemp) | |
for IP in $(dig +short 1.south-america.pool.ntp.org) ; do | |
rm -f $TMP > /dev/null 2> /dev/null | |
/usr/lib/nagios/plugins/check_ntp -H $IP > $TMP 2>&1 | |
EXIT_STATUS=$? | |
if [ "$EXIT_STATUS" -eq 0 ] ; then | |
break | |
fi | |
done | |
cat $TMP | |
rm -f $TMP > /dev/null 2> /dev/null | |
exit $EXIT_STATUS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment