    ---------------------------------------------------------
    dnsgraph - a RRDtool frontend for named (bind) Statistics
    by Jicheng Qu
    by Przemyslaw Sztoch <navy@navy.wox.org>
    based on mailgraph by David Schweikert <dws@ee.ethz.ch>
    ---------------------------------------------------------

dnsgraph is a very simple named statistics RRDtool frontend for BIND
that produces daily, weekly, monthly and yearly graphs of 
success/failure, recursion/referral, nxrrset/nxdomain (DNS traffic).

Get it from:

    http://dnsgraph.sourceforge.net
    ===============================


Required Modules
----------------

- rrdtool and it's perl module (RRDs)
  -> http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/

- File::Tail (which requires Time::HiRes)
  -> get it from CPAN

Note that several Linux distributions will already have these modules as RPMs.


Usage
-----

dnsgraph is made of two scripts:

- dnsanalise.pl

  This script does parse named-stats.log and updates the RRD database
  (named-stats.rrd). You have probably to change $rrd to point to where
  the RRD database is stored.

  DO NOT RUN IT WITH CRON WITHOUT -c PARAMETER!

  usage: dnsanalise.pl [*options*]
  
  -c, --cat          causes the logfile to be only read and not monitored
  -l, --logfile f    monitor logfile f instead of default
  -h, --help         display this help and exit
  -v, --version      output version information and exit
  
  If -c is not specified, dnsanalise will monitor logfile for stats log
  entries.

- dnsreport.pl

  This is a perl script that does generate graphics from the RRD database.
  You have probably to change $rrd to point to where the RRD database is stored.


Installation
------------

1. Install rndc tool for named.
2. Configure named. Example settings (append to your config):

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

key "rndc-key" {
    algorithm hmac-md5;
    secret "!@#your-secret-key!@#";
};

controls {
    inet 127.0.0.1 port 953
    allow { 127.0.0.1; } keys { "rndc-key"; };
};
					
3. Configure rndc tool. Example /etc/rndc.conf

key "rndc-key" {
    algorithm hmac-md5;
    secret "!@#your-secret-key!@#";
};
		
options {
    default-key "rndc-key";
    default-server 127.0.0.1;
    default-port 953;
};
			    
4. Check rndc (You may use "rndc stats")

5. Put dnsgraph's scripts somewhere.

6. Modify dnsanalise.pl. Modify $rrd, $logfile.

7. Modify dnsreport.pl. Modify $rrd.

8. Modify dnsgraph.pl. Modify TARGET and script's location.

9. Put "rndc stats" and "dnsgraph.pl" into crontab.
You may create /etc/cron.d/dnsgraph with:
*/1 * * * *    root     /usr/sbin/rndc stats
*/10 * * * *   root     /var/lib/named/bin/dnsgraph.pl \
	> /var/lib/named/named-graph.log

10. Wait 15 minutes and check charts.


License
-------

dnsgraph is released under the GPL license. See the file COPYING included in
the distribution for details.
