Cannot graph Bind statistics

Hi,

I followed step by step the how to on https://docs.librenms.org/Extensions/Applications/#bind9-aka-named to get bind statistics but it doesn’t work for me.
I created the file and changed the owner, modified the named.conf.options to add both directives and when I cat the file, I have good output which show me some statistics.
I installed cpan -i File::ReadBackwards and the config file /etc/snmp/bind.config and when I launched it I get normal output without any error :

In my snmpd.conf I added “extend bind /etc/snmp/bind -c /etc/snmp/bind.config”

but nothing in LibreNMS, graphs are empty.

Is there a thing I forgot to analyze ?

Thanks,

I can add some info. When I tried to snmpwalk from librenms to my bind server I get these error :

NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.1 = STRING: rndc: error: open: /etc/bind/rndc.key: permission denied
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.2 = STRING: rndc: could not load rndc configuration
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.3 = STRING: ‘/usr/bin/env rndc stats’ failed with a system return value of 256 at /etc/snmp/bind line 194.

I don’t understand how I can fix it.
Anyone has an idea ?

OK, just solving my issue by modifying file bind.config like that :

#rndc = The path to rndc. Default: /usr/bin/env rndc
rndc=/usr/bin/env rndc
#call_rndc = A 0/1 boolean on whether or not to call rndc stats. Suggest to set to 0 if using netdata. Default: 1
call_rndc=0 //// changed to 0 to solve issue with rndc
#stats_file = The path to the named stats file. Default: /var/run/named/stats
stats_file=/var/run/named/stats
#agent = A 0/1 boolean for if this is being used as a LibreNMS agent or not. Default: 0
agent=0
#zero_stats = A 0/1 boolean for if the stats file should be zeroed first. Default: 0 (1 if guessed)
zero_stats=0 //// changed to 0 to solve “cannot create /var/run/named/stats: Permission denied”

Finally, it’s not solved as I don’t have any graph in LibreNMS, it’s stay empty.
however, snmpwalk doesn’t get any error (except for exim, anyway):

I can see in my bind logs that the call to rndc stats is only made when I did it manually. I compared times.
Why snmpd via LibreNMS bind application don’t do that ?

And just to verify that’s the issue I manually did it several times and then I get graphs.

You need to run discovery and poller and then application does its magik :slight_smile:

By “run discovery and poller” do you mean, on librenms webui, rediscover the device :

and poller by cli with ? :

./poller.php -h myhost.example.com -m applications -d

Almost. You can do the discovery in CLI like this :

./discovery.php -h <deviceID> -v -d -m applications

That will show you exactly what happens during the discovery process, and if it fails, you’ll know why.

When it succeeds, you’ll do the same with poller :
./poller.php -h <deviceID> -v -d -m applications

And again, if it fails, you’ll know why.

OK, I just did it with no errors. I will see if it changes anything in 5 minutes as the poller is default configured…

nothing changed about graphs. Any call to rndc stats on my bind server when I look in bind.log

if I summarize :

rndc stats && cat /var/run/named/stats`

return right values and generates logs in bind.log

29-Mar-2020 15:16:45.165 general: info: received control channel command ‘stats’
29-Mar-2020 15:16:45.165 general: info: dumpstats complete

My bind.config

rndc=/usr/sbin/rndc
stats_file=/var/run/named/stats
call_rndc=0
agent=0
zero_stats=0

When I execute the script /etc/snmp/bind -c /etc/snmp/bind.config

4653,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,18,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0
340,33,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,2,0,0,0,4,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0
4841,0,30,0,0,0,4831,1,30,4689,3230,1601,93,0,49,283,10,0,4841,0,0,0
384,0,383,0,17,0,0,0,2,0,3,1,8,10,0,0,0,358,24,1,0,0,62,0
32539,29,6780,14645,0,87,210,193,580312,119760,121808,655360,133120,133120
87,22,0,0,0,0,0,0,60,0,0,0,0,0,0,0,0,1,0,5,0,0,0,1,4,0,0,0,0,0,0,0,0,0,1,0,0,9,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
2042,50,2042,25
387,2,4,2,1,385,0,2,0,0,0,0,0,0,0,0,0,382,2,0,0,1,0,0,0,0,0,0,0,0,0,2,2,3,2,1

When I do from librenms snpwalk, i get value :

When I execute poller script, I don’t get any error.
I attached it to a pastebin :
(https://pastebin.com/8fbexDBw)

Do I missed something ?

What OS/distro does your bind run on?

An early post shows permission errors which you will not get if snmpd runs as root, so my first guess is you use Debian/Ubuntu or one of it’s derivatives?

yes I use Debian on my bind server, Stretch version 9.12 and snmpd run as Debian-snmp :

[email protected]:~$ ps aux |grep snmp
Debian-+ 730 0.1 0.6 66996 12052 ? Ss mars29 2:16 /usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux mteTrigger mteTriggerConf -f

I found the extensions doc page was reasonably complete but does assume you know how to spot and fix permission errors and know where you put various files.
Here’s what I have to make the bind extend work:

The extend script needs to be able to read the named.stats file and run rndc but Debian-snmp doesn’t have those permissions and giving them is painful. I use sudo instead.

In snmpd.conf (change your path as necessary):
extend bind /usr/bin/sudo /usr/local/bin/snmp_extend/bind

in /etc/sudoers:
Debian-snmp ALL=(ALL) NOPASSWD: /usr/local/bin/snmp_extend/bind

Now the extend script runs as root so permission problems go away.

Then run (change the name and path of the stats file to what you have in named.conf):
rndc stats && cat /var/run/named/stats

apt install libfile-readbackwards-perl

Here’s my extend script’s bind.config for reference:
call_rndc=1
rndc=/usr/bin/env rndc
stats_file=/var/cache/bind/data/named.stats
zero_stats=1
agent=0

Finally, on the librenms server:
run discovery.php manually and check the output.
run poller.php manually and check the output

If that all looks good, you will get graphs after a few poller runs.

1 Like

OOoooooh you’re my god!!!
Thank you very much, it works well now. I can see logs every 5 minutes in bind.log and also a continous graph.

Please update the documentation so next people will have the solution right away :slight_smile: You can edit the doc with the little pen on the top right.
Thanx

Debian 10
I have a problem with /etc/bind/rndc.key other dont have read access.
Libranms ./poller.php dont run /etc/snmp/bind because /usr/sbin/rndc status dont start

It’s file permissions… this fixed it for me…
chmod 644 /etc/bind/rndc.key

SPOT ON !!!
Finally my BIND graphs are filling with life

Well done sir

One more thing.
Are they supposed to show zeros all the time ?

I know this is an active DNS and serves queries of our clients.

So i am not sure if the results are being updated or it was just one time lucky hit that it changed from -NaN to zeros.

Any suggestions please ?