Question:
How can I find out what query rate my BIND nameserver is handling?
Answer:
BIND produces some basic statistics that can be output to a file.
First you need to enable the statistics by specifying the output file in named.conf in the options section:
statistics-file "/var/named/named.stats";
The example above shows the default file name and location - you can name and place it anywhere that the named daemon will be able to write to it.
You also need to make sure that you can control the named daemon using rndc. You can refer to the BIND 9 Administrator Reference Manual for more details on how to do this.
Restart named (which resets the statistics counters).
For a quick estimate of query rate over 24 hours , run named for this period and then use rndc to dump the statistics that have been collected over this period:
rndc stats
Add together the first two entries in the output and then divide by the number of seconds that named has been running for. The entries in the file will look something like this:
++ Incoming Requests ++
402314 QUERY
2809 UPDATE
For more sophisticated monitoring of query rates, you can schedule rndc stats to run more frequently (every hour or every 5 minutes or less) and then use scripting techniques or import the statistical data into an analysis tool so that you can see fluctuating query rates over time - and in particular to observe your peak query rates.