summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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