Parent Directory | Revision Log
added documentation, modified default paths
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | |
5 | my $bind9_dump = shift @_ || "/var/log/stats.dump"; |
6 | my $rndc = shift @_ || "/usr/sbin/rndc"; |
7 | |
8 | system "$rndc stats"; |
9 | |
10 | my @counters = qw(success referral nxrrset nxdomain recursion failure); |
11 | |
12 | my %total; |
13 | my %forward; |
14 | my %reverse; |
15 | |
16 | open(D,$bind9_dump) || die "$bind9_dump: $!"; |
17 | while(<D>) { |
18 | next if /^(---|\+\+\+)/; |
19 | chomp; |
20 | my ($what,$nr,$direction) = split(/\s+/,$_,3); |
21 | if (! $direction) { |
22 | $total{$what} += $nr; |
23 | } elsif ($direction =~ m/in-addr.arpa/) { |
24 | $reverse{$what} += $nr; |
25 | } else { |
26 | $forward{$what} += $nr; |
27 | } |
28 | |
29 | } |
30 | close(D); |
31 | |
32 | foreach (@counters) { |
33 | print $total{$_},"\n",$forward{$_},"\n",$reverse{$_},"\n"; |
34 | } |
ViewVC Help | |
Powered by ViewVC 1.1.26 |