DNS服务解析检测脚本:
#!/bin/bash################################by:xingyaodong ##Email:osx1260@163.com ################################checkdns () {read -p "Please input the dns ipaddress:" ipread -p "Please input the dns name:" dnsnameTARGETHOST=$ipCHECKNAME=$dnsnameDIGCOM=$(dig \@$TARGETHOST $CHECKNAME | grep ";; ANSWER" | wc -l)if [ $DIGCOM -lt 1 ]; then STATUS=2 STATUSPRINT=CRITICALelse STATUS=0 STATUSPRINT=OKfiecho "$STATUSPRINT - DNS resolution for $CHECKNAME"exit $STATUS}while getopts :h: OPTIONSdocase $OPTIONS in h) TARGETHOST=$OPTARG;; *) echo "Invalid Command Line Option";;esacdonecheckdns