remove | in detail output
[mirror/dsa-nagios.git] / dsa-nagios-checks / checks / dsa-check-zone-rrsig-expiration-many
index b97cb09..445dded 100755 (executable)
@@ -120,15 +120,17 @@ for my $file (sort {$a cmp $b} (readdir INDIR)) {
        next unless ( -f "$file" );
 
        my $do_dnssec = 1;
+       my $delegated = 1;
        my $initial_refs = undef;
        open(F, '<', $file) or die ("Cannot open $file: $!\n");
        for (<F>) {
                if (/^; wzf:\s*dnssec\s*=\s*0\s*$/) { $do_dnssec = 0; }
+               if (/^; delegated\s*=\s*no\s*$/) { $delegated = 0; }
                if (/^; check-initial-refs\s*=\s*(.*?)\s*$/) { $initial_refs = $1; }
        };
        close F;
 
-       if ($do_dnssec) {
+       if ($do_dnssec && $delegated) {
                die "Duplicate zone $file?\n" if exists $dnsseczones{$file};
                $dnsseczones{$file} = {};
                $dnsseczones{$file}->{'initial_refs'} = $initial_refs if defined $initial_refs;
@@ -177,7 +179,9 @@ while (time - $begin <= $params->{timeout}) {
                else { push @{$count->{'unknown'}}, $zone; };
                delete $threads{$zone};
        }
-       sleep(1) unless scalar keys %threads == 0;
+       last if scalar keys %threads == 0;
+       print STDERR (scalar keys %threads), " threads left: ", join(" ", keys %threads), "\n" if $params->{'debug'};
+       sleep 1;
 }
 for my $zone (sort {$a cmp $b} keys %threads) {
        push @{$count->{'warn'}}, $zone;
@@ -189,7 +193,7 @@ for my $k (keys %$count) {
        @{$count->{$k}} = sort {$a cmp $b} @{$count->{$k}};
 }
 
-my $exit = 0;
+my $exit;
 my %state_mapping = (
        'unknown' => 255,
        'critical' => 2,
@@ -208,5 +212,8 @@ for my $state (sort {$state_mapping{$b} <=> $state_mapping{$a}} keys %state_mapp
 };
 printf "unsigned: %d", scalar @{$count->{'unsigned'}};
 print "\n";
-print $_ for (@details);
-exit $exit;
+for (@details) {
+       s/\|/;/g;
+       print $_;
+}
+exit ((defined $exit) ? $exit : 0);