Here are the details of some Mon tests I run:
DNS
The following tests the local DNS cache. I didn’t use example.com in my real tests, I used the domain of a multi-national corporation that has a very short DNS timeout that seems related to their use of the Akamai CDN. I won’t tell people which company to use, but I’m sure that any company that can afford Akamai can afford a query from my server every 5 minutes. ;)
watch 127.0.0.1
service dnscache
description DNS caching
interval 5m
monitor dns.monitor -caching_only -query www.example.com
period
numalerts 1
alert mailxmpp.alert -x russell@coker.com.au -m russell@coker.com.au
upalert mailxmpp.alert -x russell@coker.com.au -m russell@coker.com.au
The following section of mon.cf.m4 monitors Google DNS for the validity of domains that I host on my name server. The aim of this is to catch the case where someone forgets to pay for zone renewal so that they can pay while the zone is locked before it becomes available for domain squatters. It uses M4 so it can be generated from the BIND configuration.
watch 8.8.8.8
service myzones
description check Google DNS has my zones
interval 1h
monitor dns.monitor -caching_only QUERYDOMAINS
period
numalerts 1
alert mailxmpp.alert -x russell@coker.com.au -m russell@coker.com.au
upalert mailxmpp.alert -x russell@coker.com.au -m russell@coker.com.au
The following Makefile generates a mon.cf file from the BIND configuration that monitors the www entries in zones and the first PTR entries in IPv6 reverse zones. Note that the spaces will need to be converted to a TAB if you want to cut/paste this.
all: mon.cf
mon.cf: mon.cf.m4 /etc/bind/named.conf.local Makefile
m4 -DQUERYDOMAINS="$(shell for n in $$(grep zone /etc/bind/named.conf.local|sed -e s/^zone..// -e s/\"\ .$$//|grep -v ^//| grep -v arpa$$ ; for n in $$(grep zone.*ip6.arpa /etc/bind/named.conf.local|sed -e s/^zone..// -e s/\”\ .$$//|grep -v ^//) ; do echo -query 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.$$n:PTR ; done) ; do echo -query www.$$n ; done)" mon.cf.m4 > mon.cf
/etc/init.d/mon restart
Leave a Reply
You must be logged in to post a comment.