Old thread + first post in the forum = going south real fast?
Anyway, I think I have something to add to this thread so bare with me...
At first, thanks for timi for the template! Also, I wish to confirm that the template does indeed run on BIND 9.7+ (to 9.9.5 at least) with no problems. The reason I started writing this post was that the instructions were a bit confusing and (at least on modern systems) misleading. I have gathered information from this thread as well as ifferent Cacti/SNMP documents as well as my own trial-and-error to hopefully clear the confusions on how to use this template today...
Now, I'm running this template on Cacti server based on Raspberry (so this is a limited system with limited resources). My configuration is:
[Cacti server]
Raspbian GNU/Linux 9 (stretch)
OS: Linux higuita 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
Cacti: 0.8.8h
[BIND server]
Raspbian GNU/Linux 8 (jessie)
Linux casillas 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
BIND:
9.9.5.dfsg-9+deb8u15
I followed instructions and found, as most have reported, some tweaking to be left to the end-user of this template:
BIND server
1: CHECK your OID for BIND stats. I used .1.3.6.1.4.1.18689.0.1 (i believe this is the default within the template?). The OID is defined in [path/to/snmp/config/]snmpd.conf by adding a line
Code: Select all
extend .1.3.6.1.4.1.18689.0.1 dnscache-stats [/path/to/executables]runstats.sh
and restarting the snmp
I use
/usr/local/sbin as the path for executables but if you prefer something else, that is fine as long as you remember to chmod 755 [/path/to/executables]runstats.sh and [/path/to/executables]dnsstats.pl. If you do not use the default /root/bin for the dnsstat.pl, remember to modify the full path within runstats.sh to reflect this. Also, the original files were saved in Win-ASCII (or smthn) and you need to convert linefeeds to unix format. I used dos2unix:
for this.
Instructions stated to modify the location of named.stats dump file within bind
named.conf:
Code: Select all
statistics-file "/var/cache/bind/named.stats";
Remember to restart bind
The SNMP user must have read-write access to named.stats because the first thing the runstats.sh script does is delete the old named.stats. I added the snmp user to BIND's group
This will allow the user to delete (write) the named.stats file. NOTE: There is a snmp user within my system which I used for this one first. The SNMP results were al 'U' so after some debugging I used
www-data user for this one. Seemed to do the trick.
Cacti web interface
Increase the log level within Cacti, Console > Settings > General > Poller Logging Level: MEDIUM - Statistics, Errors and Results
Cacti server
We modified the SNMP OID in BIND server at the first step and to get results from this OID you should modify the bind-stats.sh file to reflect this. This file is located at </path/to/cacti>/scripts/bind-stats.sh.
My line in the file is:
Code: Select all
/usr/bin/snmpget -v 2c -Ovq -c public $1 .1.3.6.1.4.1.18689.0.1.4.1.2.14.100.110.115.99.97.99.104.101.45.115.116.97.116.115.2 | sed 's/"//g'| sed 's/:[[:blank:]]/:0 /g'
NOTE: I changed the line the reflect my SNMP output which puts the actual results in .2 OID. Also, I added some formatting with sed to make the results more stable/consistent.
Some of the results reported by the script may be empty. I'm not sure if this a problem for Cacti or the template or both but to make sure you get at least 0 as a result for everything, modify the
dnsstats.pl file to (the part to modify is towards the end of the file) so every variable is
=0+$var:
Code: Select all
$a=0+$ina+$outa;
$a6=0+$ina6+$outa6;
$aaaa=0+$inaaaa+$outaaaa;
$any=0+$inany+$outany;
$cname=0+$incname+$outcname;
$mx=0+$inmx+$outmx;
$naptr=0+$innaptr+$outnaptr;
$ns=0+$inns+$outns;
$ptr=0+$inptr+$outptr;
$soa=0+$insoa+$outsoa;
$spf=0+$inspf+$outspf;
$srv=0+$insrv+$outsrv;
$txt=0+$intxt+$outtxt;
Debugging
Check the poller results from (one of my 'bind stats' in Cacti's Data Source is poller with ID 268):
Code: Select all
grep "\[268\]" /var/log/cacti/cacti.log
You should see a line(s) similar to this:
Code: Select all
06/18/2018 06:19:03 PM - SPINE: Poller[0] Host[5] TH[1] DS[268] SCRIPT: /usr/share/cacti/site/scripts/bind-stats.sh casillas, output: a:1357611 a6:0 aaaa:653764 any:0 cname:0 mx:0 naptr:0 ns:55298 ptr:118128 soa:6958 spf:0 srv:224 txt:40 rsnx:88659 rsfail:215 rserr: rsipv4qs:455320 rsipv4rr:454171 rsmismatch: rsqr:174139 rsqt:1648 rsrtt10: rsrtt100500:51997 rsrtt10100:398291 rsrtt1600: rsrtt500800:3560 rsrtt8001600:338 sockopen:455924 sockclosed:456204 sockbf:216 consest:455002 recverr:2
Should this not be the case and your log shows results in U or some other not-so-measurable result, debug the runstats.sh (on BIND server):
Code: Select all
sudo -u www-data /usr/local/sbin/runstats.sh
This will report of possible access rights missing/wrong. Adjust them accordingly (as covered within this thread and this post).
Also run bind-stats.sh on the Cacti server to verify that results are fetched correctly from the BIND server to the Cacti server
Code: Select all
sudo -u [SNMP user] ./bind-stats.sh [BIND server hostname]
I have added my modified files/templates to this post. Hope you guys find this helpfull!
edit. text formatting and Debugging for clarity.