/[cricket]/parse_bind9stat.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /parse_bind9stat.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Jul 1 19:55:38 2002 UTC (17 years, 3 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +2 -2 lines
File MIME type: text/plain
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