summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-09-06 13:09:42 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-09-06 13:09:42 +0000
commitcf09119bb2067e31634133097527775580330875 (patch)
treeb1e913f036eaaa7e1253c75b56abaea6e3ba9983
parent911aac86b511ed206f3980d327058ce229a77d2e (diff)
Catch resolver.close too
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@178 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xnagios-check-soas4
1 files 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