4 # Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
5 # (Royal Institute of Technology, Stockholm, Sweden).
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # 3. Neither the name of the Institute nor the names of its contributors
20 # may be used to endorse or promote products derived from this software
21 # without specific prior written permission.
23 # THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 # ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 # You can install Net::DNS with ``perl -MCPAN -e install Net::DNS;''
51 my $comment = shift || "";
53 print ">$cell \#$comment\n";
60 print "local cellservdb\n";
61 print_cell
($cell,$comments{$cell});
62 my $hostlist = $db{$cell};
63 print foreach (@
$hostlist);
69 my $hostlist = $db{$cell};
71 print "query remote host\n";
73 foreach (@
$hostlist) {
75 system "bos listhost -server $1 -db -comment \"$comments{$cell}\" -noauth";
84 my $comment = $comments{$cell};
91 $res = new Net
::DNS
::Resolver
;
92 $query = $res->search($cell, "AFSDB");
95 foreach $rr ($query->answer) {
96 next unless $rr->type eq "AFSDB" and $rr->subtype == 1;
97 push @hosts, $rr->hostname;
101 printf ("query dns\n");
102 print_cell
($cell, $comment);
104 foreach $host (@hosts) {
105 $query = $res->search($host, "A");
107 foreach $rr ($query->answer) {
108 next unless $rr->type eq "A";
109 print $rr->address, " \#$host\n";
117 my $cellservdb = shift || "/usr/arla/etc/CellServDB";
121 open FILE
, "<$cellservdb";
125 if (/^>([^ \t]*)[\t ]*#(.*)/) {
127 $comments{$cell} = $2;
129 } elsif (/^>([^ \t]*)/) {
131 $comments{$cell} = "";
136 my @hostcopy = @hosts;
137 $db{$cell} = \
@hostcopy;
139 while (defined(pop @hosts)) {}
147 print "check-cellservdb.pl";
149 print "\t--cell <cellname>\n";
150 print "\t--CellServDB <file>\n";
152 print "\t--nolocal\n";
153 print "\t--noremote\n";
165 GetOptions
("help" => \
&usag
,
167 "CellServDB=s" => \
$cellservdb,
169 "noremote" => \
$noremote,
170 "nolocal" => \
$nolocal,
174 parse_cellservdb
($cellservdb);
178 foreach $query_cell (sort { reverse($a) cmp reverse($b) } keys %db) {
180 query_local_cell
($query_cell) if(!$nolocal);
181 query_remote_cell
($query_cell) if(!$noremote);
182 query_afsdb
($query_cell) if (!$nodns);
185 query_local_cell
($cell) if(!$nolocal);
186 query_remote_cell
($cell) if(!$noremote);
187 query_afsdb
($cell) if (!$nodns);