complete error description
authorheiko
Tue, 30 Dec 2014 23:27:37 +0100
changeset 8 a220ea51b60b
parent 7 f027886d3617
child 9 b2a26d05b063
complete error description
plugins/check_dns-serial
--- a/plugins/check_dns-serial	Tue Dec 30 15:02:36 2014 +0100
+++ b/plugins/check_dns-serial	Tue Dec 30 23:27:37 2014 +0100
@@ -133,16 +133,22 @@
 sub ns_ok {
     my ($domain, $reference) = @_;
 
-    my @our = sort +ns($domain, nameservers => [$reference], aa => 1);
-    my @their = sort +ns($domain);
+    my @errs;
+    my @our = eval { sort +ns($domain, nameservers => [$reference], aa => 1) };
+    push @errs, $@ if $@;
+    my @their = eval { sort +ns($domain) };
+    push @errs, $@ if $@;
 
-    {
-        local $" = "\0";
-        return 1 if "@our" eq "@their";
+    if (!@errs) {
+        local $" = ', ';
+	if ("@our" eq "@their") {
+		return 1;
+	}
+        die "NS differ (our @our) vs (their @their)\n";
     }
+    chomp @errs;
+    die join(', ', @errs) . "\n";
 
-    local $" = ', ';
-    die "NS differ (our @our) vs (their @their)\n";
 }
 
 sub main {
@@ -171,8 +177,8 @@
     foreach my $domain (@domains) {
         print STDERR "$domain " if $opt_progress;
         eval { ns_ok($domain, $opt_reference) };
-        if ($@) { $CRITICAL{$domain} = $@ }
-        else    { push @OK, $domain }
+	if ($@) { $CRITICAL{$domain} = $@ }
+        else { push @OK, $domain }
         say STDERR $@ ? 'not ok' : 'ok' if $opt_progress;
     }