[rrd-users] Re: DNS monitor?

Vijay vijay.s at net4india.net
Mon Dec 9 11:15:04 MET 2002


Hi,

 Use the following script to first collect the values of the A,PTR,NS etc .

******************************************************
#!/usr/bin/perl

# setup some variables so people can easily modify this for their use
$stats_file = "/var/named/named.stats";
$ndc_binary = "/usr/sbin/ndc stats";

# if you don't want ndc to use its default channel, make it like this:
#$ndc_channel = "-c /usr/local/etc/ndc.d/ndc";

# otherwise, leave this null:
$ndc_channel = "";

# don't touch this unless you plan to modify the RRD database, and I'm
#  not including instructions on how to do that ;)
@query_types = qw( A PTR ANY MX NS CNAME SOA SRV AAAA );
$counter = 0;
$total = 0;

if ((system("$ndc_binary $ndc_channel stats > /dev/null 2>&1"))) {
	die "Can't dump BIND stats: $!\n"
}

foreach (@query_types){

	$d[$counter] = get_query_stats_by_type ($_);
#	print "type is: $_ \n";
	print "$d[$counter] ";
	$counter++;
}

# get the total
foreach ( $i = 0; $i <= 8; $i++ ) {
	$total += $d[$i];
}

#print "TOTAL $total\n";
print "$total\n";

$d[9] = $total ;

if ((system("cp /dev/null $stats_file"))) {
	die "Can't zero out bind stats: $!\n"
}

sub get_query_stats_by_type () {
        my ($type) = $_;

	open(FILE, "< $stats_file") or die "Can't open stats file: $!";

	@lines = <FILE>;
	while ($line = pop @lines) {

		if ( $line =~ s/^(\d+)\s+\b$type\b queries$/$1/ )


			chomp $line;
			# print "There have been $line $type queries\n";
			return $line;
		}
	};

	# if we ever get here, then we didn't find the string  at all
	print "Unable to retrieve the stats\n";
}
***********************************************************************

Replace the binary file of the bind and the named stats path with the one
that has been configured on the system. After this configure a new RRD
database to include all the variables that have to be mapped.
Something like this :
rrdtool create bind.rrd         \
            DS:a:COUNTER:600:U:U   \
            DS:ptr:COUNTER:600:U:U   \
             DS:mx:COUNTER:600:U:U   \
                 DS:ns:COUNTER:600:U:U   \
                 DS:cname:COUNTER:600:U:U   \
                 DS:soa:COUNTER:600:U:U   \
                 DS:aaaa:COUNTER:600:U:U   \
            RRA:AVERAGE:0.5:1:600      \
            RRA:AVERAGE:0.5:6:700      \
            RRA:AVERAGE:0.5:24:775     \
            RRA:AVERAGE:0.5:288:797    \
            RRA:MAX:0.5:1:600          \
            RRA:MAX:0.5:6:700          \
            RRA:MAX:0.5:24:775         \
            RRA:MAX:0.5:288:797


In the RRD fetch part run the script for which the source has already been
given in the first part and input the values returned and then graph it.

PS : Thanks to the mailing list that i could use theis program.

Vijay
Assistant Manager Networking
Net 4 India Ltd.,
110/111 , Shah & Nahar Ind Estate,
Dr E.Moses Road , Worli Naka,
Worli , Mumbai -400 018
Tel: +91 22 4988511
Fax: +91 22 4988543
Mobile: +91 9820187096

URL: http://www.net4india.com

____________________________________________________________________________
_______________________________________
This message may contain confidential and/or privilegedinformation. If you
are not the addressee or authorized to
receive this for the addressee, you must not use, copy,disclose or take any
action based on this message or any
information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.
____________________________________________________________________________
________________________________________





-----Original Message-----
From: rrd-users-bounce at list.ee.ethz.ch
[mailto:rrd-users-bounce at list.ee.ethz.ch]On Behalf Of Munn, Stuart
SITI-IT-DIETS
Sent: Monday, December 09, 2002 3:19 PM
To: RRD-Users
Subject: [rrd-users] DNS monitor?



Folks,

I want to monitor my Bind 9 DNS server is there any good tools that use RRD
that will help me get started? I was thinking of using netsaint as well.

Any Help advice for me?

Much appreciated.

Regards

Stuart

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list