/[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.1 - (show annotations)
Mon Jul 1 19:19:47 2002 UTC (21 years, 9 months ago) by dpavlin
Branch: MAIN
File MIME type: text/plain
script for bind9 stat dumper (dumps bind9 stat file and parse it for cricket)

1 #!/usr/bin/perl -w
2
3 use strict;
4
5 my $bind9_dump = "/var/log/named/stats.dump";
6 my $rndc = "/usr/local/sbin/rndc stats";
7
8 system $rndc;
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