DNS plugin updated

Former-commit-id: c9b9da2c19eeeae743691b6d250ee2bbe09179cb
This commit is contained in:
fbsanchez 2019-03-13 12:42:17 +01:00
parent 046a126889
commit 83fc35c0c8
1 changed files with 10 additions and 21 deletions

View File

@ -68,27 +68,16 @@ then
help
fi
TMPFILE=/tmp/dns_$DNS_CHECK.tmp
dig @$DNS_CHECK $DOMAIN_CHECK > $TMPFILE
RETURN_IP=`cat $TMPFILE | grep "^$DOMAIN_CHECK" | awk '{print $5}'`
RETURN_TIMEOUT=`cat $TMPFILE | grep "Query time" | grep -o "[0-9]*"`
rm $TMPFILE 2> /dev/null
if [ $TIMEOUT_CHECK == 1 ]
then
echo $RETURN_TIMEOUT
exit 0
fi
if [ "$RETURN_IP" != "$IP_CHECK" ]
then
echo 0
exit 1
else
echo 1
exit 0
fi
results=`dig @$DNS_CHECK +nocmd $DOMAIN_CHECK +multiline +noall +answer A`
targets=`echo "$results"| awk '{print $5}'`
for x in $targets; do
if [ "$x" == "$IP_CHECK" ]; then
echo 1
exit 0
fi
done
echo 0
exit 0