From cf09119bb2067e31634133097527775580330875 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 6 Sep 2006 13:09:42 +0000 Subject: Catch resolver.close too git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@178 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- nagios-check-soas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nagios-check-soas b/nagios-check-soas index a67e22d..3360039 100755 --- a/nagios-check-soas +++ b/nagios-check-soas @@ -37,19 +37,19 @@ ARGV.each{ |domain| warnings << "Nameserver #{nameserver} for #{domain} has #{arecords.length} A records" if arecords.length != 1 arecords.each{ |a| puts " Nameserver #{nameserver} is at #{a.address}" if @verbose > 0 - resolver = Resolv::DNS.new({:nameserver => a.address.to_s}) begin + resolver = Resolv::DNS.new({:nameserver => a.address.to_s}) soas = resolver.getresources(domain, Resolv::DNS::Resource::IN::SOA) rescue SystemCallError => e warnings << "Could not resolve #{domain} on #{nameserver}: #{e.message}" else + resolver.close warnings << "Nameserver #{nameserver} for #{domain} returns #{soas.length} SOAs" if soas.length != 1 soas.each{ |soa| puts " Nameserver #{nameserver} returns serial #{soa.serial} for #{domain}" if @verbose > 0 serial << soa.serial unless serial.include? soa.serial } end - resolver.close } } case serial.length -- cgit v1.2.3