How to monitor Bind with Munin on Debian Jessie

Munin is a networked resource monitoring tool for monitoring your servers. Bind is most widely used open source software that implements the Domain Name System (DNS) protocols for the Internet. This manual doesn’t cover Munin or Bind installation, only the manual how to sync those two together to display queries from Bind inside Munin, here is how you do it :

1. Set some logging permissions for bind

# mkdir /var/log/bind9
# chown bind:bind /var/log/bind9
# service bind9 restart

2. Edit /etc/bind/named.conf.options and add these settings:
logging {
         channel b_log {
                 file "/var/log/bind9/bind.log" versions 30 size 1m;
                 print-time yes;
                 print-category yes;
                 print-severity yes;
                 severity info;
         };
 
         channel b_debug {
                 file "/var/log/bind9/debug.log" versions 2 size 1m;
                 print-time yes;
                 print-category yes;
                 print-severity yes;
                 severity dynamic;
         };
 
         channel b_query {
                 file "/var/log/bind9/query.log" versions 2 size 1m;
                 print-time yes;
                 severity info;
         };
 
         category default { b_log; b_debug; };
         category config { b_log; b_debug; };
         category queries { b_query; };
   };

3. Restart bind
# service bind9 restart

4. Configure munin-node plugin
# ln -s /usr/share/munin/plugins/bind9 /etc/munin/plugins/bind9

5. In /etc/munin/plugin-conf.d/munin-node make sure you have declared bind9 plugin: 
[bind9]
user root

6. Restart munin-node
# service munin-node restart

7. Enable rndc statistics in bind. Add a context inside /etc/bind/named.conf.options
statistics-file "/etc/bind/zones/statistics";
zone-statistics yes;

8. Create zones directory and statistics file
# mkdir /etc/bind/zones
# chown bind.bind /etc/bind/zones
# touch /etc/bind/zones/statistics
# chown bind.bind /etc/bind/zones/statistics

9. Restart bind
# service bind9 restart

10. Run rndc statistics
# rndc stats

11. Enable bind9_rndc plugin in munin
# ln -s /usr/share/munin/plugins/bind9_rndc /etc/munin/plugins/bind9_rndc

12. In /etc/munin/plugin-conf.d/munin-node make sure you have declared bind9_rndc plugin
[bind9_rndc]
user root
env.querystats /etc/bind/zones/statistics

13. Restart munin-node
# service munin-node restart

This should be all. Wait about 10 minutes that Munin 
graphs become visible and they will look like this:
MonitorBindWithMunin_1_originalMonitorBindWithMunin_2_original