plugins/check_dns-delegation
changeset 16 6d401297850b
parent 15 bb7b3ae76cc8
child 17 07827090c4fc
child 18 e21e904c1320
equal deleted inserted replaced
15:bb7b3ae76cc8 16:6d401297850b
    13 =head1 DESCRIPTION
    13 =head1 DESCRIPTION
    14 
    14 
    15 B<check_dns-delegation> is designed as a Icinga/Nagios plugin to verify that
    15 B<check_dns-delegation> is designed as a Icinga/Nagios plugin to verify that
    16 all responsible NS know about the delegation.
    16 all responsible NS know about the delegation.
    17 
    17 
    18 Each domain has to survive the following tests:
    18 Each domain has to pass the following tests:
    19 
    19 
    20 =over
    20 =over
    21 
    21 
    22 =item The I<reference> server needs to be authoritive.
    22 =item The I<reference> server needs to be authoritive.
    23 
    23 
    56 use warnings;
    56 use warnings;
    57 use Getopt::Long qw(GetOptionsFromArray);
    57 use Getopt::Long qw(GetOptionsFromArray);
    58 use Net::DNS;
    58 use Net::DNS;
    59 use Pod::Usage;
    59 use Pod::Usage;
    60 use if $ENV{DEBUG} => 'Smart::Comments';
    60 use if $ENV{DEBUG} => 'Smart::Comments';
       
    61 use List::Util qw(shuffle);
    61 
    62 
    62 sub uniq { my %h; @h{@_} = (); return keys %h; }
    63 sub uniq { my %h; @h{@_} = (); return keys %h; }
    63 my @extns = qw(8.8.8.8 8.8.4.4);
    64 my @extns = qw(8.8.8.8 8.8.4.4);
    64 
    65 
    65 package Net::DNS::Resolver {
    66 package Net::DNS::Resolver {
   236       or pod2usage;
   237       or pod2usage;
   237     my @domains = get_domains(@argv);
   238     my @domains = get_domains(@argv);
   238     my %override = read_override($opt_override) if defined $opt_override;
   239     my %override = read_override($opt_override) if defined $opt_override;
   239 
   240 
   240     my (@OK, %CRITICAL);
   241     my (@OK, %CRITICAL);
   241     foreach my $domain (@domains) {
   242     foreach my $domain (shuffle @domains, keys %override) {
   242         print STDERR "$domain " if $opt_progress;
   243         print STDERR "$domain " if $opt_progress;
   243 
   244 
   244         my @ns = eval { ns_ok($domain, $opt_reference, \%override) };
   245         my @ns = eval { ns_ok($domain, $opt_reference, \%override) };
   245 	if ($@) { 
   246 	if ($@) { 
   246             $CRITICAL{$domain} = $@;
   247             $CRITICAL{$domain} = $@;