BIND 9.7 (only) host template

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Re: BIND 9.7 (only) host template

Post by JJX »

eviltrooper wrote:hello.

what about an update for 9.9 because 9.7 is very old ;)
Although 9.7 scripts still work on 9.9
An update for v9.9 would be great
cacti rulez!
twister5800
Posts: 1
Joined: Sun Oct 22, 2017 12:07 am

Re: BIND 9.7 (only) host template

Post by twister5800 »

Hi,

I'm totally NOOB in cacti, but I have the newest version running (1.1.26)

have all scripts and templates installed, i can see the bind-stats template in data template, but how can I use it to graph my bind server?

When I create a new graph the bind-stats is missing from the drop down lists?

UPDATE:
I did follow this:
https://www.cacti.net/downloads/docs/html/how_to.html

I can get the graph visible but it is not populated..

Can anyone write a step by step guide for the bind-template?
Just the cacti part, as the scripts work :-)


Best regards Martin
samw41l
Posts: 1
Joined: Tue Jan 02, 2018 10:05 pm

Re: BIND 9.7 (only) host template

Post by samw41l »

Thanks for the template.

Just some fix for empty return value:

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.1 | sed 's/"//g' | sed 's/:[[:blank:]]/:0 /g'
At least now I got green log lines :wink:
raspberryUser
Posts: 1
Joined: Mon Jun 18, 2018 9:44 am

Re: BIND 9.7 (only) host template

Post by raspberryUser »

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

Code: Select all

systemctl restart snmpd
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:

Code: Select all

dos2unix runstats.sh

Code: Select all

dos2unix dnsstats.pl
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

Code: Select all

systemctl restart bind9
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

Code: Select all

usermod -G [SNMP user] bind
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.
bind-stats.sh
(349 Bytes) Downloaded 281 times
cacti_data_template_bind_stats.xml
(33.54 KiB) Downloaded 288 times
runstats.sh
(157 Bytes) Downloaded 286 times
dnsstats.pl
(5.61 KiB) Downloaded 263 times
MarvinDo
Posts: 3
Joined: Mon May 08, 2017 6:25 am

Re: BIND 9.7 (only) host template

Post by MarvinDo »

Hello All,

does the RTT graph work for you? I just see 2 lines, so some values are missing. The snmp response looks fine for me. So i am wondering why this happens.

Anyone who can help me out here?

Thanks
Attachments
942EC9CD-3B00-41B6-BB55-B12C652547C4.jpeg
942EC9CD-3B00-41B6-BB55-B12C652547C4.jpeg (214.62 KiB) Viewed 2632 times
3954AC72-4F39-4D85-A42E-95E274B2D033.jpeg
3954AC72-4F39-4D85-A42E-95E274B2D033.jpeg (504.31 KiB) Viewed 2632 times
34B9DDEC-8D55-4A60-A0CC-ABA7D44F547A.jpeg
34B9DDEC-8D55-4A60-A0CC-ABA7D44F547A.jpeg (252.2 KiB) Viewed 2632 times
kevinmorales
Posts: 13
Joined: Wed Mar 13, 2013 10:57 am
Location: Nicaragua

Re: BIND 9.7 (only) host template

Post by kevinmorales »

Hi, why my graph show me around 150 queries when my DNS recevie a lot of queries?, I am using BIND 9.11.26
Kevin Morales
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests