BIND 8/9 based DNS monitoring
Moderators: Developers, Moderators
-
- Posts: 35
- Joined: Sat Apr 13, 2002 5:16 pm
- Location: Santa Barbara, CA
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
(look for phrase "stats")
-gwynnebaer
Re: named.stats
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*--
--*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:I have bind 9.2.0, and my named.stats only contains the above. Any ideas on how I can expand this?Code: Select all
+++ Statistics Dump +++ (1020033800) success 13 referral 0 nxrrset 0 nxdomain 10 recursion 22 failure 0 --- Statistics Dump --- (1020033800)
Thanks,
Andy
Hi,
here is another well working script fpr bind9 stats...
hint: check the paths to your named.stats file an the rndc binary
to run this, put following with your own oid in your snmpd.conf:
with snmpwalk you get the following results:
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
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
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
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
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
Cheers
graph: http://hobbes.sa-char.net/cacti/graph.p ... &rraid=all
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:bulek wrote:You should use COUNTER instead of GAUGE as a data source type.
- bulek
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
BIND 9.2 Stat Dump Expansion
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.
Any help is greatly appreciated.
Re: named.stats
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.ablyler wrote:I have bind 9.2.0, and my named.stats only contains the above. Any ideas on how I can expand this?Code: Select all
+++ Statistics Dump +++ (1020033800) success 13 referral 0 nxrrset 0 nxdomain 10 recursion 22 failure 0 --- Statistics Dump --- (1020033800)
Thanks,
Andy
Cory
Re: named.stats
Same here ...ablyler wrote:I have bind 9.2.0, and my named.stats only contains the above. Any ideas on how I can expand this?Code: Select all
+++ Statistics Dump +++ (1020033800) success 13 referral 0 nxrrset 0 nxdomain 10 recursion 22 failure 0 --- Statistics Dump --- (1020033800)
Thanks,
Andy
Realy weird ...
Greetz.
RattleSn@ke.
Works ... but not completly ... :s
This worked ... but when I'm using the package meant earlier, both options (local and snmp) do not work ...Anonymous wrote:Add the following to your bind config
zone-statistics yes;
When using the snmp option, i receive 'object unknown' errors.
While the first (local) option returns nothing ...
Any help is welcome.
Greetz,
RattleSn@ke.
Damn ... I still can't figure out why it won't work ...
I placed this in snmpd.conf
And when I then restart snmpd and run this command:
I get this as result ...:
Somebody any idea whats going wrong?
Thanks.
Greetz.
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
Code: Select all
snmpwalk -v 2c -c COMM HOST .1.3.6.1.4.1.2021.55
Code: Select all
UCD-SNMP-MIB::ucdavis.55 = No Such Instance currently exists at this OID
Thanks.
Greetz.
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]
Who is online
Users browsing this forum: No registered users and 5 guests