Skip to main content.

rndcstats.pl

Intended for use with BIND 9, uses the rndc stats command and file to calculate number of queries per second.

Download the latest version of rndcstats.pl

Documentation/Examples

History

rndcstats.pl - perldoc

NAME

rndcstats.pl - Uses the rndc stats command and file to calculate number of queries per second.

SYNOPSIS

rndcstats.pl <start>

DESCRIPTION

Intended for use with BIND 9

The following parameter is required when you first run the script:

start

Indicates that this is the first time you have run the script and creates a base stats file which subsequent calls of the script will use. Once you have used rndcstats.pl start once, further calls should just use rndcstats.pl.

Use rndcstats.pl start if you want to start the count from zero again.

You need an entry like:

  options {
    statistics-file "/var/log/named.stats";
  }

in your named.conf file

If you host any domains and want per zone statistics, also add the following to your named.conf file:

  options {
    zone-statistics yes;
  }

Also you may have to edit the $ENV{'PATH'}, $dir, $start_statsfile, $current_statsfile, $rndc and $nameduserid variables at the top of this script.

EXAMPLE

Here is an example using the start parameter:

  $ ./rndcstats.pl start
  rndc: stats command successful
  rndc: stats command successful

  STATS BREAKDOWN OF "/var/log/named.stats"
  stats since: Wed Jan  9 13:36:56 2002 (6s ago)

  MAIN SERVER:
  Type             Queries   Total/sec
  ------------------------------------
  success:             856     142.667
  referral:             29       4.833
  nxrrset:              10       1.667
  nxdomain:             64      10.667
  recursion:            74      12.333
  failure:              23       3.833
  ------------------------------------
  Totals:              982     163.667

Note: "Totals" does not include the "recursion" value.  Each query received by the server will cause exactly one of "success", "referral", "nxrrset", "nxdomain" or "failure" to be incremented, and may additionally cause the "recursion" counter to be incremented. (Bv9ARM.ch06.html)


Here is another example:

  $ ./rndcstats.pl
  rndc: stats command successful

  STATS BREAKDOWN OF "/var/log/named.stats"
  stats since: Fri Jan  4 11:58:16 2002 (438038s ago)

  MAIN SERVER:
  Type             Queries   Total/sec
  ------------------------------------
  success:        56675383     129.385
  referral:           6363       0.015
  nxrrset:          430961       0.984
  nxdomain:        4427082      10.107
  recursion:       4272573       9.754
  failure:          611513       1.396
  ------------------------------------
  Totals:         62151302     141.886

Note: "Totals" does not include the "recursion" value.  Each query received by the server will cause exactly one of "success", "referral", "nxrrset", "nxdomain" or "failure" to be incremented, and may additionally cause the "recursion" counter to be incremented. (Bv9ARM.ch06.html)


And another example with zone-statistics turn on:

  $ ./rndcstats.pl
  rndc: stats command successful

  STATS BREAKDOWN OF "/var/log/named.stats"
  stats since: Wed Jan  9 13:07:34 2002 (2009s ago)

  MAIN SERVER:
  Type             Queries   Total/sec
  ------------------------------------
  success:           39907      19.864
  referral:           5769       2.872
  nxrrset:            2310       1.150
  nxdomain:           6553       3.262
  recursion:          4062       2.022
  failure:            1478       0.736
  ------------------------------------
  Totals:            56017      27.883

Note: "Totals" does not include the "recursion" value.  Each query received by the server will cause exactly one of "success", "referral", "nxrrset", "nxdomain" or "failure" to be incremented, and may additionally cause the "recursion" counter to be incremented. (Bv9ARM.ch06.html)


  ZONES:
       success    referral     nxrrset    nxdomain     failure       total   total/sec  zone
  ----------------------------------------------------------------------------------------------
          7327           0         146         273           0        7746       3.856  foo.net
          5472           0         308          20           0        5800       2.887  foo.co.uk
          3791           0          29          48           0        3868       1.925  foo.bar.net
           425           0           0           8           0         433       0.216  1.168.192.in-addr.arpa
           407           0           5           0           0         412       0.205  foo.bar.com
           350           0           7           0           0         357       0.178  foo.bar.co.uk
  ----------------------------------------------------------------------------------------------
       success    referral     nxrrset    nxdomain     failure       total   total/sec  zone

BUGS

You need a fairly large terminal to display all the stats on the screen.

SEE ALSO

perlsec, perlpod, perlsyn, rndc

AUTHOR

Chris Pile

http://www.snoogans.co.uk/