Cannot graph Bind statistics

Hi,

I followed step by step the how to on Applications - LibreNMS Docs 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 :

root@ns1:~$ 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 ?

Had similar problem. uncommit the below line in named.conf and working fine.

vim /etc/named.conf

options {
statistics-file “/var/named/data/named_stats.txt”;

vim /etc/snmp/bind

my $call_rndc=1;
my $rndc=’/usr/bin/env rndc’;
#my $stats_file=’/var/cache/bind/stats’;
my $stats_file=’/var/named/data/named_stats.txt’;

then restarted the named and snmpd.

snmpwalk -v2c -c community-name localhost NET-SNMP-EXTEND-MIB::nsExtendOutput2Table | grep bind

NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.1 = STRING: 35099,728,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,0,53,0,0,0,43,0,0,0,0,1,0,0,0,0,0,280,0,0,0,0,0,0,71
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.2 = STRING: 4944,2647,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,105,0,0,0,82,0,0,0,0,0,0,0,0,0,0,152,0,0,0,0,0,0,11
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.3 = STRING: 36347,0,33527,17,78,32080,36320,17,33526,2818,1217,2910,271,35,1038,1674,12,32158,0,0,0,0
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.4 = STRING: 4895,3072,4685,3017,442,28,0,1,1812,1,2235,230,1052,1064,25,247,404,2074,4386,834,3,0,0,0
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.5 = STRING: 0,0,0,0,0,0,0,0,0,0,0,0,0,0
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.6 = STRING: 3534,2341,0,0,0,0,0,0,516,0,0,0,102,0,0,0,0,6,0,975,21,0,0,13,372,0,0,0,0,0,0,0,0,0,18,0,0,255,0,0,0,0,0,7,281,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,11
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.7 = STRING: 0,0,0,0
NET-SNMP-EXTEND-MIB::nsExtendOutLine.“bind”.8 = STRING: 3906,2272,1015,801,1,3868,2267,1014,790,1,0,0,0,0,0,0,0,3884,1008,2271,801,27,0,0,0,0,0,0,0,1,0,0,0,0,0,0