lib/Nagios/Check/DNS/delegation.pm
changeset 25 88749a69668e
parent 24 d20452378ead
child 26 d465c78373ca
equal deleted inserted replaced
24:d20452378ead 25:88749a69668e
    26 
    26 
    27 # return a list of the zones known to the local
    27 # return a list of the zones known to the local
    28 # bind
    28 # bind
    29 sub get_local_zones {
    29 sub get_local_zones {
    30     my @conf;
    30     my @conf;
    31     open(my $z, '-|', 'named-checkconf -p');
    31     open(my $z, '-|') or do {
       
    32         my $bind_directory;
       
    33         open(my $x, '-|', 'named-checkconf -p');
       
    34         while (<$x>) {
       
    35             /^\s*directory\s+"(.*)";/ and $bind_directory = $1;
       
    36             print;
       
    37         }
       
    38         if (defined $bind_directory) {
       
    39             local @ARGV = grep { -f } glob "$bind_directory/*nzf";
       
    40             print <> if @ARGV;
       
    41         }
       
    42         exit 0;
       
    43     };
    32     while (<$z>) {
    44     while (<$z>) {
    33         state $line;
    45         state $line;
    34         s/^\s*(.*?)\s*$/$1 /;
    46         s/^\s*(.*?)\s*$/$1 /;
    35         chomp($line .= $_);    # continuation line
    47         chomp($line .= $_);    # continuation line
    36         if (/\A\}/) {          # config item done
    48         if (/\A\}/) {          # config item done