Fwd: Querying the SOA timers

Balder balder.theglorious at googlemail.com
Tue Feb 1 10:02:43 UTC 2011

On 1 February 2011 10:04,  <pyh at mail.nsbeta.info> wrote:
> I once wrote a perl script for nagios plugin and posted it to the list.
> Just to check both master and slave's serial number to see if they are the
> same to verify the zone data in every name server is correct.
Thanks for this however it would be useful if i could query the timers
maintained at the slave server directly as It is still possible for a
slave server to have an up-to-date serial but still expire the zone.

The only way i can think of getting something close to what i want is
by checking the file modification time zone on disc and adding the
zone expiry to that.  something like the following (this assumes you
have all zones in on folder and the file name is the same as the
zone).  however i know this is not perfect if anyone has anything
better please let me know

for zone in $(ls);
   zone_lastupdated=$(stat -c %Z ${zone});
   expiry=$(dig +short SOA ${zone} @localhost | awk '{print $6}') ;
   zone_expires=$((zone_lastupdated + expiry));
  echo ${zone} Expires on $(date --date "$[$(date
+%s)-${zone_expires}] seconds ago");

thanks john

More information about the bind-users mailing list