X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=dsa-nagios-checks%2Fchecks%2Fdsa-check-zone-rrsig-expiration-many;h=cfbacfd3b78f2b42c6ae1d37c01d072201734916;hb=3756e9519c4d13cdc6757d4329667481d12d6732;hp=376ba48dbcec4f77e3294ba8915b98c20c1a1a44;hpb=d619d2e77d5c32c363577732af512c0b2b4197b4;p=mirror%2Fdsa-nagios.git diff --git a/dsa-nagios-checks/checks/dsa-check-zone-rrsig-expiration-many b/dsa-nagios-checks/checks/dsa-check-zone-rrsig-expiration-many index 376ba48..cfbacfd 100755 --- a/dsa-nagios-checks/checks/dsa-check-zone-rrsig-expiration-many +++ b/dsa-nagios-checks/checks/dsa-check-zone-rrsig-expiration-many @@ -71,6 +71,7 @@ sub check_one { my @cmd = ($check, '-w', $params->{'warn'}, '-c', $params->{'critical'}); push(@cmd, '-r', $extra->{'initial_refs'}) if exists $extra->{'initial_refs'}; + push(@cmd, '-d') if $params->{'debug'}; push(@cmd, $zone); open(P, '-|', @cmd) or die ("Cannot run $CHECK for $zone\n"); my @p =

; @@ -82,13 +83,14 @@ sub check_one { return ($res, \@p); } -my $USAGE = "Usage: $PROGRAM_NAME [--help] | [--timeout=] [--warn=] [--critical=] [--geozonedir=] \n"; +my $USAGE = "Usage: $PROGRAM_NAME [--help] | [--debug] [--timeout=] [--warn=] [--critical=] [--geozonedir=] \n"; my $params = { 'timeout' => 45, 'warn' => '14d', 'critical' => '7d' }; Getopt::Long::config('bundling'); GetOptions ( '--help' => \$params->{'help'}, '--timeout=i' => \$params->{'timeout'}, '--warn=s' => \$params->{'warn'}, + '--debug' => \$params->{'debug'}, '--critical=s' => \$params->{'critical'}, '--geozonedir=s' => \$params->{'geozonedir'}, ) or die ($USAGE); @@ -175,7 +177,9 @@ while (time - $begin <= $params->{timeout}) { else { push @{$count->{'unknown'}}, $zone; }; delete $threads{$zone}; } - sleep(1) unless scalar keys %threads == 0; + # print STDERR "foo #threads:", (scalar keys %threads), ":", join(",", keys %threads),"\n"; + last if scalar keys %threads == 0; + sleep 1; } for my $zone (sort {$a cmp $b} keys %threads) { push @{$count->{'warn'}}, $zone; @@ -187,7 +191,7 @@ for my $k (keys %$count) { @{$count->{$k}} = sort {$a cmp $b} @{$count->{$k}}; } -my $exit = 255; +my $exit; my %state_mapping = ( 'unknown' => 255, 'critical' => 2, @@ -207,4 +211,4 @@ 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; +exit ((defined $exit) ? $exit : 0);