Measuring Queries for Records in Particular Zones

5.15.1 Problem

You want to measure the number of queries a name server receives for records in zones it is authoritative for.

5.15.2 Solution

Use the BIND 9 zone-statistics substatement. To measure the statistics for just a few zones, use zone-statistics as a zone substatement. For example:

zone "foo.example" {
 type slave;
 masters { 192.168.0.1; };
 file "bak.foo.example";
 zone-statistics yes;
};

To keep statistics for all zones, use zone-statistics as an options substatement:

options {
 directory "/var/named";
 zone-statistics yes;
};

Then, to dump the zone's statistics, use rndc stats. The statistics are written to the file named.stats in the name server's working directory, by default. Here's a short sample of a named.stats file:

+++ Statistics Dump +++ (1020821387)
success 37
referral 0
nxrrset 60
nxdomain 9
recursion 12
failure 6
success 6 foo.example
referral 0 foo.example
nxrrset 3 foo.example
nxdomain 1 foo.example
recursion 0 foo.example
failure 0 foo.example
--- Statistics Dump --- (1020821387)

The first six counters are global: total counts for the name server since it started. The next six are specific to the foo.example zone. The sum of the zone-specific values for success, nxrrset, and nxdomain is the total number of queries for records in the zone. (nxrrset is a count of queries for types of records that didn't exist, while nxdomain counts queries for domain names that didn't exist).

5.15.3 Discussion

There's no mechanism comparable to zone-statistics in BIND 8. While you could turn on query logging and extrapolate the same statistics, the overhead would be considerable.

Speaking of overhead, the zone statistics mechanism does use a little extra memory on the name server to store the counters.

5.15.4 See Also

Section 5.13 for information on query logging, which can tell you who is querying a name server; and Section 5.14, for measuring aggregate performance.

Getting Started

Zone Data

BIND Name Server Configuration

Electronic Mail

BIND Name Server Operations

Delegation and Registration

Security

Interoperability and Upgrading

Resolvers and Programming

Logging and Troubleshooting

IPv6



DNS & BIND Cookbook
DNS & BIND Cookbook
ISBN: 0596004109
EAN: 2147483647
Year: 2005
Pages: 220
Authors: Cricket Liu

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net