monitoring bind9 DNS server with Zabbix

DNS-in-zabbix graph example

This is how to monitor the amount of queries in bind9 (version required is bind 9.5 at least) with Zabbix.

You need a working Zabbix server to follow these steps.

First, enable statistics in bind9. To do so, add the following line in /etc/bind/named.conf. (The location of the file can vary for different distributions). Do not put it between options {}!

statistics-channels {
 inet port 8053 allow {; };

Then, restart bind:

# service bind9 restart

This enables a web service within bind. To query it, we use curl and to flatten the served XML we use xml2. Both must be installed for this to work. On Debian flowered systems, simply do this:

# apt-get install xml2 curl

Now you can try to query by hand:

# curl http://localhost:8053/ 2>/dev/null | xml2 | grep -A1 queries

This spits out the counter for every request done against your nameserver. Now, configure Zabbix agents so they can get data to monitor this. Add the following two lines to /etc/zabbix/zabbix_agentd.conf:[*],curl http://localhost:8053/ 2>/dev/null | xml2 | grep -A1 "/isc/bind/statistics/server/queries-in/rdtype/name=$1$" | tail -1 | cut -d= -f2
UserParameter=bind.queries.out[*],curl http://localhost:8053/ 2>/dev/null | xml2 | grep -A1 "/isc/bind/statistics/views/view/rdtype/name=$1$" | tail -1 | cut -d= -f2

Then, restart zabbix agent:

# service zabbix-agent restart

And now you can add items to your Zabbix config like so:[A]

Or, download my template ( zabbix-bind9-dns-template ) and import it in Zabbix. The following is then pre configured:

  • A records in & out
  • AAAA records in & out
  • ANY records in & out
  • CNAME records in & out
  • MX records in & out
  • NS records in & out
  • PTR records in & out
  • SOA records in & out
  • SPF records in & out
  • TXT records in & out
  • All queries in graph
  • All queries out graph



  1. Hi,

    do you know how can i parser xml in centos?


  2. mr51m0n

    03.12.2013 at 14:01

    Hi Vukomir

    I could not figure out how to do this, a simple command like xml2 does not seem to exist!
    I guess the easiest way is to use xsltproc and write a proper XSLT file.


  3. Thanks you so much for this, works perfectly, saved me loads of work.

  4. Works fine, thank you.

  5. Hello

    I use:
    starting BIND 9.9.5-9-Debian

    Error log :
    /etc/bind/named.conf.options:28: unknown option ‘statistics-channels’

    What to do?
    Thank you for your help


  6. mr51m0n

    24.08.2015 at 21:33

    Hey Mz

    Can you post your /etc/bind/named.conf.options file?

  7. Hello, thank you for monitoring dns.
    Why you set 2 this 2 minutes, why not 1 minute, or 30 seconds?

  8. 2 is delta,parser eating )

  9. mr51m0n

    05.01.2016 at 11:56

    Hey cru5ader

    You can change it as you like. For me this is enough, since honestly I’m more interested in history. Also it needs more performance and storage on the Zabbix server if you reduce the time between checks.

    You may edit the template as you wish to fit your needs.

Leave a Reply

Your email address will not be published.


© 2016 netmess

Theme by Anders NorenUp ↑