Monitoring BIND 9.6 with ZABBIX on Ubuntu

Basic concept is simple – BIND will generate XML file with statistics, PHP script output values we want into standalone files and we read those values with ZABBIX agent.

We gonna need PHP to process XML statistics from BIND, install it with:

Turn on integrated BIND webserver with statistics in configuration file named.conf:

And reload: service bind9 reload

Let’s say that we will have our statistics in /home/bindstat. Save there PHP file stats.php:

Edit crontab and add lines to download statistics and parse them:

Make sure we have proper rights and owners:

Finally add file for ZABBIX agent /etc/zabbix/zabbix_agentd.d/bind.conf with content:

And restart: /etc/init.d/zabbix-agent reload

To use with ZABBIX start with this template from ZABBIX 2.0 with basic items and triggers. Also you can download template from Zabbix 4.4 here.


Share Button

10 komentářů

  1. Hi,

    Thanks your work. I found 2 mistake in this write.
    1st: You not closed the stats.php with ?> tag.
    2nd: the crontab settings wrong, becasue the 2 process always run at the same time, and a stats.php couldn’t open stats.xml when is open t owrite. The correct crontab is the following:

    */1 * * * * curl -s > /var/local/zabbix/stats.xml && /usr/bin/php5 -f /var/local/zabbix/stats.php

    You have to concatenate the 2 process with double & sign. The second part of this row runs after success end of fist part. So every process will make a good exit.

  2. Hi,

    I’m using your script and I have been face this ERROR PHP .

    PHP Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() in /usr/local/etc/bind/stats.php:4
    Stack trace:
    #0 {main}
    thrown in /usr/local/etc/bind/stats.php on line 4

    Do you know how can I fixed it?

  3. Hello ,
    First thank u very much for ur work
    but i have issue , i can’t import the template , i have problem

    Details Import failed
    Invalid tag „/zabbix_export/templates/template(1)/items/item(1)“: the tag „logtimefmt“ is missing.

    1. Hello,

      you’re welcome! Are you sure that it is my tepmplate you’re importing? That error message doesn’t make much sense to me, there are no tags at all (so no logtimefmt). URL to my template which is in article above is:

      It should work, I also checked the first items in template and haven’t found any strange tags there 🙂

  4. Hello ,

    thank u for ur response , so i try again and i have the same problem,
    can u help me to fix this problem sir

    Best regards,

    1. Hello,

      not sure how much can I do for you. Obviously problem is not presence of any unsupported tags, but quite the opposite. Your ZABBIX is having problem with missing tag, that I do not use (and need). That template I provided before is from old server, I made new export from actual version 4.4:

      Try this. If it doesn’t work (and there is no tag logtimefmt as well), try updating your ZABBIX.

      Hope you will make this work.

      1. Hello ,
        Thank u for updating template , i import this template it works ,
        but zabbix didn’t collect data for exemple the graph is empty no data in the graph

        Sorry for my bad english


        1. Hello,

          no problem, I can understand your english. Now you need to debug where the problem is. I really do not have time to do this with you step by step, but in general:
          1) Can you downolad and see statistics in XML on machine with BIND server?
          2) Is PHP processing that XML file OK (you should see files like QryNXDOMAIN within stats.php and stats.xml directory)?
          3) Do ZABBIX agent have and read keys defined in zabbix_agentd.d/bind.conf (on same server with bind and ZABBIX agent you can try to get these values with zabbix_agent and parameter „t“)?

          If so, then you should be able to use this template with no problem and it should read all correctly.

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *