#
#FILE
#	README
#	$Id$
#AUTHOR
#	(C) 2008-2009 Dylan for Unixservice Portland - GPLv2 applies
#PURPOSE
#	Initial brief explanation of code in this directory.
#	Install instructions for graphing and non graphing NSs.
#

This new per zone data collection interface is to replace old pipe based 
querylog interface.

It works by using BIND9 named.conf based per zone named.stats crontab generated
file. Please make sure your named.conf has the following global setting:

	//tHit susbsystem required
	zone-statistics yes;

This file is then processed by a very efficient C program that parses from 
named.stats the tHit data and insers it into the iDNS database.

tHitCollector created with make using the current local.h settings can also be used
to create, feed and generate rrdtool graphs with per cZone aggregated stats per zone
or the default special allzone.stats (see top of named.stats).

See the bind9 .sh script for more info on setting up the collector.

Please make; make install in this dir then continue...

---
Please note that slave servers only provide data to the tHit table, they do not usually have to 
graph rrdtool pngs.

---
Setting up the basic allzone named.stats (special zone in tHit allzone.stats) rrdtool dbs:

1 and 2 Only for graphing servers:
1 bash> mkdir /var/log/named/
2 bash> /usr/sbin/tHitCollector Initialize --cZone allzone.stats

3 bash> chown named:named /usr/local/idns/named.d
4 bash> cp -i bind9-genstats.sh /usr/sbin/bind9-genstats.sh
Test:
5 bash> /usr/sbin/bind9-genstats.sh
6 bash> crontab -e
Add:
	#Place next line in root crontab for iDNS tHit subsystem
	*/5 * * * * /usr/sbin/bind9-genstats.sh >> /var/log/idns-cron.log 2>&1

Then continue with crontab section below if on a NS that will graph.


ONLY FOR graphing servers:

---
Setting up additonal zone graphics

bash> /usr/sbin/tHitCollector Initialize --cZone somezoneinthit.com.ar

---
Example crontab section for the rrdtool functions:

#
#mysqlBind2/iDNS tHit interface option for adding aggregate data then graphing with rrdtool
#
#default cZone allzone.stats for a allzone.stats.png in file constant /var/log/named/ directory.
*/5 * * * * sleep 10; nice /usr/sbin/tHitCollector AddData >> /tmp/delme 2>&1; nice /usr/sbin/tHitCollector Graph >> /tmp/delme 2>&1;
#somezoneinthit.com.png
*/5 * * * * sleep 20; nice /usr/sbin/tHitCollector AddData --cZone somezoneinthit.com >> /tmp/delme 2>&1; nice /usr/sbin/tHitCollector Graph --cZone somezoneinthit.com >> /tmp/delme 2>&1;

#make sure rrdtool is your root crontab path
#/tmp/delme is just for initial testing; once tested change to /dev/null
