plugins/check_dns-delegation
changeset 17 07827090c4fc
parent 16 6d401297850b
child 19 3ea8010e4fbc
equal deleted inserted replaced
16:6d401297850b 17:07827090c4fc
    44 =item B<local:>
    44 =item B<local:>
    45 
    45 
    46 This item uses the output of C<named-checkconf -p> to get the list of
    46 This item uses the output of C<named-checkconf -p> to get the list of
    47 master/slave zones. The 127.in-addr.arpa, 168.192.in-addr.arpa, and
    47 master/slave zones. The 127.in-addr.arpa, 168.192.in-addr.arpa, and
    48 0.in-addr.arpa, and 127.in-addr.arpa zones are suppressed.
    48 0.in-addr.arpa, and 127.in-addr.arpa zones are suppressed.
       
    49 
       
    50 The B<override> domains are added automatically (See opt B<override>).
    49 
    51 
    50 =back
    52 =back
    51 
    53 
    52 =cut
    54 =cut
    53 
    55 
    98 	not /^localhost$/;
   100 	not /^localhost$/;
    99     } map { /zone\s"(\S+)"\s/ } grep { /type (?:master|slave)/ } @conf;
   101     } map { /zone\s"(\S+)"\s/ } grep { /type (?:master|slave)/ } @conf;
   100 }
   102 }
   101 
   103 
   102 sub get_domains {
   104 sub get_domains {
   103     my @sources = @_;
   105     my %arg = @_;
       
   106     my @sources = @{ $arg{sources} };
   104     my @domains = ();
   107     my @domains = ();
   105 
   108 
   106     foreach my $src (@sources) {
   109     foreach my $src (@sources) {
   107 
   110 
   108         if ($src =~ m{^(?:(/.*)|file://(/.*))}) {
   111         if ($src =~ m{^(?:(/.*)|file://(/.*))}) {
   111             next;
   114             next;
   112         }
   115         }
   113 
   116 
   114         if ($src =~ m{^local:}) {
   117         if ($src =~ m{^local:}) {
   115             push @domains, get_local_zones;
   118             push @domains, get_local_zones;
       
   119             push @domains, @{$arg{local}} if $arg{override};
   116             next;
   120             next;
   117         }
   121         }
   118 
   122 
   119         push @domains, $src;
   123         push @domains, $src;
   120     }
   124     }
   233             );
   237             );
   234         }
   238         }
   235       )
   239       )
   236       and @argv
   240       and @argv
   237       or pod2usage;
   241       or pod2usage;
   238     my @domains = get_domains(@argv);
       
   239     my %override = read_override($opt_override) if defined $opt_override;
   242     my %override = read_override($opt_override) if defined $opt_override;
       
   243     my @domains = get_domains(sources => \@argv, local => [keys %override]);
   240 
   244 
   241     my (@OK, %CRITICAL);
   245     my (@OK, %CRITICAL);
   242     foreach my $domain (shuffle @domains, keys %override) {
   246     foreach my $domain (shuffle @domains) {
   243         print STDERR "$domain " if $opt_progress;
   247         print STDERR "$domain " if $opt_progress;
   244 
   248 
   245         my @ns = eval { ns_ok($domain, $opt_reference, \%override) };
   249         my @ns = eval { ns_ok($domain, $opt_reference, \%override) };
   246 	if ($@) { 
   250 	if ($@) { 
   247             $CRITICAL{$domain} = $@;
   251             $CRITICAL{$domain} = $@;