/[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

Annotation of /parse_bind9stat.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Mon Jul 1 19:45:19 2002 UTC (17 years, 3 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +3 -3 lines
File MIME type: text/plain
select dump file and rndc location from command line

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