check_service() { SERVICE=0 nslookup www.somesite.com some.incorrect.ip.address >/dev/null 2>&1 if [ $? -eq 1 ]; then SERVICE=1;fi if [ $SERVICE -eq 1 ]; then echo "SQUID NOK - One or more TCP/IP ports not listening." exitstatus=$STATE_CRITICAL exit $exitstatus fi } check_service echo "NAMED OK - Everything running like it should" exitstatus=$STATE_OK exit $exitstatus