check_service() { SERVICE=1 nslookup www.some.com x.x.x.221 | grep "connection timed out" >/dev/null 2>&1 ; echo $? if [ $? -eq 0 ]; then SERVICE=0;fi if [ $SERVICE -eq 0 ]; then echo "NAMED NOT OK - BIND server appears to be down" exitstatus=$STATE_CRITICAL exit $exitstatus fi } check_service echo "NAMED OK - Everything running like it should" exitstatus=$STATE_OK exit $exitstatus