Bind : Monitor performances
dnsmon

With this project, you will have, for free, a way to track your Bind DNS server performances. This solution is based on the following products :

Here is the logical architecture :
dnsmon_arch

This is the requirements for the monitoring/webserver system :
– a linux server (for me it is a Debian one)
– apache
– rndc tool : apt-get install bind9utils
– RRDTool : apt-get install rrdtool
– python and rrdtool module : apt-get install python-rrdtool

First you have to configure your DNS Bind server to accept rndc commands from a remote host. Add the following lines in your named.conf file :

The IP address specified is the IP address of your monitoring/webserver system. The TCP port 7766 is used for rndc communication between the monitoring and the DNS server. To be able to generate the named.stats file in the Bind log folder, add the following line in the “options” section in the file named.conf.options of your Bind server(s) :

On the Bind server, you can now reload the Bind configuration files : rndc reload

On the monitoring/webserver, you have to add the rndc key of each Bind server you want to manage by editing the file /etc/bind/rndc.conf as follow :

The secret keys can be found on each Bind dns server on the following file : /etc/bind/rndc.key

You can test if the rndc command works from the monitoring/webserver : rndc -s dns-server01.domain.local -p 7766 status

You can uncompress the following file on the monitoring/webserver folder /var/www . A new folder will be created containing the web pages, the libraries and the monitoring script.

Now you have to configure the sshFS mount points between the monitoring and DNS servers. The folder /var/www/dnsmon/log will be the root folder. Create inside one folder per DNS server :

On the monitoring/webserver create the ssh key with no passphrase :

You can now copy the public key on your DNS servers :

On the monitoring server, edit the /etc/fstab and add the lines :

You can now, launch the following command to mount the new points added before : mount -a

Now, you have to configure the file /var/www/dnsmon/rrdconfig.ini according to your environment.

Try to launch manually the monitoring script : python monitor.py
The following folders will have some new files : images, rrd and xml

If it is ok, you can now set the cron job on the monitoring server:

Go to the url : http://yourwebsite/yourfolder/grid.php?timespan=Daily

This is a first shot documentation. Do not hesitate to leave a comment if there is something wrong or missing.


References

RRDTool

Highcharts

4 thoughts on “Bind : Monitor performances

  • November 11, 2014 at 19:04
    Permalink

    What version of python did you use for this?

    python monitor.py
    File “monitor.py”, line 83
    for timespan in timespans:

    Running pythong 2.6

    Reply
    • November 12, 2014 at 08:06
      Permalink

      Hello TomT,

      I’m running the version 2.7.6 for Python

      Reply
      • November 12, 2014 at 17:22
        Permalink

        Cheers, managed to get it going 🙂
        I’m having a few issues adding more than one host though, /etc/bind/rndc.conf doesn’t seem to exist and adding the server params into /etc/rndc.key throws an exception. Going to bash around with it today to try get it going.

        Reply
        • November 12, 2014 at 17:49
          Permalink

          Nvm, figured it out 🙂 Bind will by default first search for /etc/rndc.key before it uses /etc/bind/rndc.conf. I deleted the /etc/rndc.key and everything is happy 🙂

          Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: