Monitor BIND dns server using CollectD and InfluxDB

In this article we will explain how to monitor BIND dns server using Collectd , InfluxDB and Grafana. We will use the “bind” plugin in the CollectD for this.
Starting with BIND 9.5.0, BIND DNS server software provides extensive statistics about queries, responses and lots of other information. The CollectD “bind” plugin retrieves this information and submits the values to CollectD.

First , we will configure BIND to expose the statistics on port “8153” . Add the following lines to your bind/named configuration.

1 2 3   vi /etc/named.conf  

Add following line

1 2 3 4 5   statisticschannels { inet 127.0.0.1 port 8053; };  

Restart bind/named using

1 2 3   service named restart  

OR using systemctl

1 2 3   systemctl restart named  

Now, we will verify if named is listening on port 8053

1 2 3 4 5   [root@test.test.com ~]# netstat -nap |grep 8053 tcp 0 0 127.0.0.1:8053 0.0.0.0:* LISTEN 21874/named [root@test.test.com ~]#  

Yes, named daemon is binding on port 8053.

Now we will configure CollectD to “retrieve metrics” from the above port and forward the metric data to InfluxDB server.

Add the following inside the CollectD configuration

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18   LoadPlugin bind URL “http://127.0.0.1:8053/” OpCodes true QTypes true   ServerStats true ZoneMaintStats true ResolverStats false MemoryStats true #### Following config lines enabled CollectD to forward the metrics data to InfluxDB server LoadPlugin network Server “192.168.2.17” “25836”  

Restart CollectD using

1 2 3   service collectd restart  

OR using systemctl

1 2 3   systemctl restart collectd  

Now we will check in InfluxDB ,to see if its receiving data from CollectD

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16   [root@test.test.com ~]# influx Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 0.13.0 InfluxDB shell version: 0.13.0 > use collectd Using database collectd > show series key bind_value,host=test.test.com,instance=_defaultresolver_stats,type=dns_query,type_instance=IPv4 bind_value,host=test.test.com,instance=_defaultresolver_stats,type=dns_query,type_instance=IPv6 bind_value,host=test.test.com,instance=_defaultresolver_stats,type=dns_query,type_instance=retry bind_value,host=test.test.com,instance=_defaultresolver_stats,type=dns_rcode,type_instance=rxEDNS0Fail bind_value,host=test.test.com,instance=_defaultresolver_stats,type=dns_rcode,type_instance=rxFORMERR bind_value,host=test.test.com,instance=_defaultresolver_stats,type=dns_rcode,type_instance=rxNXDOMAIN  

Yes, metric data for bind is there inside InfluxDB server. Now we will see how to visualize this metrics using Grafana. I have created a video on how to add InfluxDB data inside Grafana. Please check it out 

Please check the official docs here and here for more details. 

SUMMARY

In this article we explained how to monitor bind dns server using CollectD, Influxdb and Grafana. Feel free to contact us if you have any questions.Always happy to help ????

 

Author: , 0000-00-00