[mrtg] Re: MRTG and Bind 9

UK Internet Sites lists at ukinternetsites.com
Mon Mar 25 23:16:54 MET 2002


Here is a very quick, dity and easy method for doing it which I wrote for our own needs
:-)

#!/usr/local/bin/perl

`rndc stats`;
@data = `tail -n 15 /home/DNS/named.stats`;

$old_ok = $data[0];
$old_fail = $data[5];
$old_ok =~ tr/^[0-9]\ //cd;
$old_fail =~ tr/^[0-9]\ //cd;

$ok = $data[8];
$fail = $data[13];
$ok =~ tr/^[0-9]\ //cd;
$fail =~ tr/^[0-9]\ //cd;

$ok = $ok - $old_ok;
$fail = $fail - $old_fail;
unless ($ok eq "0"){ $ok ++; }
unless ($fail eq "0"){ $fail ++; }

print "$ok\n$fail";

exit;

It just runs the rndc stats command, then uses `tail` to read the named.stats file (change
the location to where it is based on your server) and compares the last value and the
newest value and outputs the differents.  Feel free to use it - and do what you like it to
:-)

The basic mrtg config I use for this is (not sure if its the right way....)

Target[dns]: `/usr/local/mrtg-2/scripts/dns.pl`
Options[dns]: gauge,absolute,integer,nopercent,growright
MaxBytes[dns]: 100000
YLegend[dns]: # of queries
ShortLegend[dns]: q/m
LegendI[dns]:  # of successful queries:
LegendO[dns]:  # of failed queries:

Enjoy...

Graeme Sandwell




> Does anyone have instructions on getting MRTG to work with Bind 9?
>
> -Ellick
>
>
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://www.ee.ethz.ch/~slist/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>
>


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list