[Xymon] Modernizing the DNS check

Henrik Størner henrik at hswn.dk
Fri Jan 10 07:08:43 CET 2014


Den 10-01-2014 01:02, Adam Goryachev skrev:
> On 08/01/14 19:39, Henrik Størner wrote:
>> I think this should be a separate test from the normal "dns" column?
>>
> IMHO, this really should be an ext test.

You mean, like this?


#!/bin/sh

DOMAIN=$1; shift

SERVERS="`host -tNS $DOMAIN | awk '{print $4}' | xargs echo`"

if test -f /tmp/soarec-$DOMAIN.$$
then
         rm -f /tmp/soarec-$DOMAIN.$$
fi

for H in $SERVERS
do
         SOAREC=`host -tSOA $DOMAIN $H | grep SOA`
         if test $? -eq 0
         then
                 echo "$H: $SOAREC" >> /tmp/soarec-$DOMAIN.$$
         fi
done

RECCOUNT=`cat /tmp/soarec-$DOMAIN.$$ | cut -d: -f2- | sort | uniq -c | 
wc -l`

if test $RECCOUNT -eq 1
then
         echo "green: All SOA records match"
else
         echo "red: Different SOA records on the nameservers"
fi

cat /tmp/soarec-$DOMAIN.$$
rm -f /tmp/soarec-$DOMAIN.$$

exit 0


Modifying this to actually send a status report is left as an excercise 
for the reader :-) While you're at it, make it use "xymongrep" to pick 
up the domains you want to test.


Regards,
Henrik




More information about the Xymon mailing list