BIND 8/9 based DNS monitoring

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

mhmghmg

Post by mhmghmg »

meee tooo :(
gwynnebaer
Posts: 35
Joined: Sat Apr 13, 2002 5:16 pm
Location: Santa Barbara, CA

Post by gwynnebaer »

There was a significant change to stat usage in BIND v9. Look at the PDF manual for more help: http://www.nominum.com/resources/docume ... Bv9ARM.pdf

(look for phrase "stats")

-gwynnebaer
George

Re: named.stats

Post by George »

try this:

--*snip**
#!/bin/sh
#
# script for pulling stats from bind 9
# george@alink.co.za 10.02.03
#
rm /var/named/named.stats
/usr/sbin/rndc stats
for i in `cat /var/named/named.stats | grep -v Statistics | awk '{ print $2 }'` ; do total=$(($total+$i)); done;
echo $total;

--*snip*--
ablyler wrote:

Code: Select all

+++ Statistics Dump +++ (1020033800)
success 13
referral 0
nxrrset 0
nxdomain 10
recursion 22
failure 0
--- Statistics Dump --- (1020033800)
I have bind 9.2.0, and my named.stats only contains the above. Any ideas on how I can expand this?

Thanks,
Andy
unyks
Posts: 5
Joined: Wed Feb 12, 2003 3:35 pm
Location: Stuttgart/Germany

Post by unyks »

Hi,

here is another well working script fpr bind9 stats...

hint: check the paths to your named.stats file an the rndc binary

Code: Select all

#!/usr/bin/perl -w

# Parse output from bind9 rndc stats command
# Dobrica Pavlinusic, <dpavlin@rot13.org>
# http://www.rot13.org/~dpavlin/sysadm.html
#
# Usage: parse_bind9stat.pl [/var/log/stats.dump [/usr/sbin/rndc]]

use strict;

my $log = shift @ARGV || "/chroot/named/var/run/named.stats";
my $rndc = shift @ARGV || "/usr/local/named/sbin/rndc";
my $delta="/var/tmp/";

system "$rndc stats";

my @counters = qw(success referral nxrrset nxdomain recursion failure);

my %total;
my %forward;
my %reverse;

my $tmp=$log;
$tmp=~s/\W/_/g;
$delta.=$tmp.".offset";

open(DUMP,$log) || die "$log: $!";

if (-e $delta) {
        open(D,$delta) || die "can't open delta file '$delta' for '$log': $!";
        my $offset=<D>;
        chomp $offset;
        close(D);
        my $log_size = -s $log;
        if ($offset <= $log_size) {
                seek(DUMP,$offset,0);
        }
}

while(<DUMP>) {
        next if /^(---|\+\+\+)/;
        chomp;
        my ($what,$nr,$direction) = split(/\s+/,$_,3);
        if (! $direction) {
                $total{$what} += $nr;
        } elsif ($direction =~ m/in-addr.arpa/) {
                $reverse{$what} += $nr;
        } else {
                $forward{$what} += $nr;
        }

}

open(D,"> $delta") || die "can't open delta file '$delta' for log '$log': $!";
print D tell(DUMP);
close(D);

close(DUMP);

foreach (@counters) {
        print $total{$_},"\n",$forward{$_},"\n",$reverse{$_},"\n";
}

to run this, put following with your own oid in your snmpd.conf:

Code: Select all

exec    .1.3.6.1.4.1.2021.60 yourscriptname /usr/local/bin/yourscriptname.pl
with snmpwalk you get the following results:

Code: Select all

snmpwalk -On -c mycommuity myhost .1.3.6.1.4.1.2021.60
.1.3.6.1.4.1.2021.60.1.1 = 1
.1.3.6.1.4.1.2021.60.2.1 = "bindstats"
.1.3.6.1.4.1.2021.60.3.1 = "/usr/local/bin/bindstat.pl"
.1.3.6.1.4.1.2021.60.100.1 = 0
.1.3.6.1.4.1.2021.60.101.1 = "419458"
.1.3.6.1.4.1.2021.60.101.2 = "240473"
.1.3.6.1.4.1.2021.60.101.3 = "186"
.1.3.6.1.4.1.2021.60.101.4 = "322524"
.1.3.6.1.4.1.2021.60.101.5 = "81"
.1.3.6.1.4.1.2021.60.101.6 = "0"
.1.3.6.1.4.1.2021.60.101.7 = "131737"
.1.3.6.1.4.1.2021.60.101.8 = "96823"
.1.3.6.1.4.1.2021.60.101.9 = "0"
.1.3.6.1.4.1.2021.60.101.10 = "59173"
.1.3.6.1.4.1.2021.60.101.11 = "16450"
.1.3.6.1.4.1.2021.60.101.12 = "94"
.1.3.6.1.4.1.2021.60.101.13 = "69552"
.1.3.6.1.4.1.2021.60.101.14 = "14"
.1.3.6.1.4.1.2021.60.101.15 = "0"
.1.3.6.1.4.1.2021.60.101.16 = "17985"
.1.3.6.1.4.1.2021.60.101.17 = "0"
.1.3.6.1.4.1.2021.60.101.18 = "0"
.1.3.6.1.4.1.2021.60.102.1 = 0
the oids are...

datasource success-t .1.3.6.1.4.1.2021.60.101.1
datasource referral-t .1.3.6.1.4.1.2021.60.101.2
datasource nxrrset-t .1.3.6.1.4.1.2021.60.101.3
datasource nxdomain-t .1.3.6.1.4.1.2021.60.101.4
datasource recursion-t .1.3.6.1.4.1.2021.60.101.5
datasource failure-t .1.3.6.1.4.1.2021.60.101.6

datasource success-f .1.3.6.1.4.1.2021.60.101.7
datasource referral-f .1.3.6.1.4.1.2021.60.101.8
datasource nxrrset-f .1.3.6.1.4.1.2021.60.101.9
datasource nxdomain-f .1.3.6.1.4.1.2021.60.101.10
datasource recursion-f .1.3.6.1.4.1.2021.60.101.11
datasource failure-f .1.3.6.1.4.1.2021.60.101.12

datasource success-r .1.3.6.1.4.1.2021.60.101.13
datasource referral-r .1.3.6.1.4.1.2021.60.101.14
datasource nxrrset-r .1.3.6.1.4.1.2021.60.101.15
datasource nxdomain-r .1.3.6.1.4.1.2021.60.101.16
datasource recursion-r .1.3.6.1.4.1.2021.60.101.17
datasource failure-r .1.3.6.1.4.1.2021.60.101.18


greets

Chris
sachar
Posts: 14
Joined: Sun Apr 21, 2002 9:52 pm

Post by sachar »

thanks for the script chris, but seems that I'm doing something wrong. My traph is only rizing, any tips of which datasources, graph type etc I have to choose?

Cheers

graph: http://hobbes.sa-char.net/cacti/graph.p ... &rraid=all
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

You should use COUNTER instead of GAUGE as a data source type.

- bulek
asteffes

Post by asteffes »

bulek wrote:You should use COUNTER instead of GAUGE as a data source type.

- bulek
I'm not sure how this is working for anyone. On my system, net-snmp is returning each of the OID's values as a string, not an integer. Cacti doesn't seem to know what to do with that string since it's in quotes:

asteffes@iceburg /usr/local/bin > ./snmpwalk -OS -c foobar somehostname .1.3.6.1.4.1.2021.60.101.4
UCD-SNMP-MIB::ucdavis.60.101.4 = "6"

Can anyone explain how they got this to work?

-Adam
JMU1337
Posts: 1
Joined: Thu Jul 24, 2003 1:33 pm

BIND 9.2 Stat Dump Expansion

Post by JMU1337 »

In order to complete a DNS monitoring task, I need to get some DNS stats. Unfortunately, the machine I'm working on is running BIND 9.2 and the stat dump is very meager. Are there any options I can set to expand the amount of data that is logged?

Any help is greatly appreciated.
Guest

graphs

Post by Guest »

Can anyone explain how I get this into cacti with some easy description? :)

I've gotten so far that I have created a xml-file that seems to work ok.



regards
Robin
cpowers
Posts: 2
Joined: Mon Jan 05, 2004 12:11 pm

Re: named.stats

Post by cpowers »

ablyler wrote:

Code: Select all

+++ Statistics Dump +++ (1020033800)
success 13
referral 0
nxrrset 0
nxdomain 10
recursion 22
failure 0
--- Statistics Dump --- (1020033800)
I have bind 9.2.0, and my named.stats only contains the above. Any ideas on how I can expand this?

Thanks,
Andy
I have created a package for monitoring BIND 9 stats see this post http://www.raxnet.net/board/viewtopic.php?t=3018 for more info.

Cory
RattleSn@ke

Re: named.stats

Post by RattleSn@ke »

ablyler wrote:

Code: Select all

+++ Statistics Dump +++ (1020033800)
success 13
referral 0
nxrrset 0
nxdomain 10
recursion 22
failure 0
--- Statistics Dump --- (1020033800)
I have bind 9.2.0, and my named.stats only contains the above. Any ideas on how I can expand this?

Thanks,
Andy
Same here ...
Realy weird ...

Greetz.
RattleSn@ke.
Guest

Post by Guest »

Add the following to your bind config

zone-statistics yes;
RattleSn@ke

Works ... but not completly ... :s

Post by RattleSn@ke »

Anonymous wrote:Add the following to your bind config

zone-statistics yes;
This worked ... but when I'm using the package meant earlier, both options (local and snmp) do not work ...

When using the snmp option, i receive 'object unknown' errors.
While the first (local) option returns nothing ...

Any help is welcome.


Greetz,
RattleSn@ke.
RattleSn@ke

Post by RattleSn@ke »

Damn ... I still can't figure out why it won't work ...

I placed this in snmpd.conf

Code: Select all

pass .1.3.6.1.4.1.2021.55 /usr/bin/perl /custom/bin/bind9-stats-snmpd.pl
And when I then restart snmpd and run this command:

Code: Select all

snmpwalk -v 2c -c COMM HOST .1.3.6.1.4.1.2021.55
I get this as result ...:

Code: Select all

UCD-SNMP-MIB::ucdavis.55 = No Such Instance currently exists at this OID
Somebody any idea whats going wrong?

Thanks.

Greetz.
RattleSn@ke

Post by RattleSn@ke »

Here's the output of the debug command in Cacti...

Code: Select all

+ Running data query [11].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/www/cacti/resource/snmp_queries/bind9-stats-snmp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.55.1'
+ Located input field 'bindIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2021.55.1'
+ Found item [bindIndex='No Such Instance currently exists at this OID'] index: 1 [from value]
+ Located input field 'bindName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2021.55.2'
+ Found item [bindName='No Such Instance currently exists at this OID'] index: 2 [from value]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest