{"id":810,"date":"2015-09-04T13:35:22","date_gmt":"2015-09-04T11:35:22","guid":{"rendered":"http:\/\/blog.prunk.si\/?p=810"},"modified":"2021-03-13T10:54:29","modified_gmt":"2021-03-13T09:54:29","slug":"how-to-monitor-bind-with-munin-on-debian-jessie","status":"publish","type":"post","link":"https:\/\/blog.janprunk.com\/?p=810","title":{"rendered":"How to monitor Bind with Munin on Debian Jessie"},"content":{"rendered":"<p><a href=\"http:\/\/munin-monitoring.org\/\" target=\"_blank\" rel=\"noopener\">Munin<\/a> is a networked resource monitoring tool for monitoring your servers. <a href=\"https:\/\/www.isc.org\/downloads\/bind\/\" target=\"_blank\" rel=\"noopener\">Bind<\/a> is most widely used open source software that implements the Domain Name System (DNS) protocols for the Internet. This manual doesn&#8217;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 :<\/p>\n<pre>1. Set some logging permissions for bind<strong>\n\n# mkdir \/var\/log\/bind9\n# chown bind:bind \/var\/log\/bind9\n# service bind9 restart\n\n<\/strong>2. Edit <i>\/etc\/bind\/named.conf.option<\/i><i>s<\/i><i> <\/i><i>and add these settings:<\/i>\n<strong>logging {\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 channel b_log {\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 file \"\/var\/log\/bind9\/bind.log\" versions 30 size 1m;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-time yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-category yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-severity yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 severity info;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 };\n \n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 channel b_debug {\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 file \"\/var\/log\/bind9\/debug.log\" versions 2 size 1m;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-time yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-category yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-severity yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 severity dynamic;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 };\n \n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 channel b_query {\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 file \"\/var\/log\/bind9\/query.log\" versions 2 size 1m;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 print-time yes;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 severity info;\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 };\n \n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 category default { b_log; b_debug; };\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 category config { b_log; b_debug; };\n \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 category queries { b_query; };\n \u00c2\u00a0 };<\/strong>\n\n3. Restart bind\n<strong># service bind9 restart\n<\/strong>\n4. Configure munin-node plugin\n<strong># ln -s \/usr\/share\/munin\/plugins\/bind9 \/etc\/munin\/plugins\/bind9\n\n<\/strong>5. In <i>\/etc\/munin\/plugin-conf.d\/munin-node<\/i> make sure you have declared bind9 plugin:<strong> \n[bind9]\nuser root\n\n<\/strong>6. Restart munin-node<strong>\n# service munin-node restart\n\n<\/strong>7. Enable rndc statistics in bind. Add a context inside \/etc\/bind\/named.conf.options<strong>\nstatistics-file \"\/etc\/bind\/zones\/statistics\";\nzone-statistics yes;\n\n<\/strong>8. Create zones directory and statistics file<strong>\n# mkdir \/etc\/bind\/zones\n# chown bind.bind \/etc\/bind\/zones\n# touch \/etc\/bind\/zones\/statistics\n# chown bind.bind \/etc\/bind\/zones\/statistics\n\n<\/strong>9. Restart bind<strong>\n# service bind9 restart\n\n<\/strong>10. Run rndc statistics<strong>\n# rndc stats\n\n<\/strong>11. Enable bind9_rndc plugin in munin\n<strong># ln -s \/usr\/share\/munin\/plugins\/bind9_rndc \/etc\/munin\/plugins\/bind9_rndc\n\n<\/strong>12. In <i>\/etc\/munin\/plugin-conf.d\/munin-node<\/i> make sure you have declared bind9_rndc plugin\n<strong>[bind9_rndc]\nuser root\nenv.querystats \/etc\/bind\/zones\/statistics\n\n<\/strong>13. Restart munin-node<strong>\n# service munin-node restart\n\n<\/strong>14. Create \/etc\/apparmor.d\/local\/usr.sbin.named and add this content:<strong>\n\/var\/log\/bind9\/** rw,\n\/var\/log\/bind9\/ rw,\n\n<\/strong>This should be all. Wait about 10 minutes that Munin \ngraphs become visible and they will look like this:\n<\/pre>\n<pre><strong><a href=\"http:\/\/blog.prunk.si\/wp-uploads\/\/2015\/09\/MonitorBindWithMunin_1_original.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-818\" src=\"http:\/\/blog.prunk.si\/wp-uploads\/\/2015\/09\/MonitorBindWithMunin_1_original.png\" alt=\"MonitorBindWithMunin_1_original\" width=\"493\" height=\"541\" srcset=\"https:\/\/blog.janprunk.com\/wp-content\/uploads\/2015\/09\/MonitorBindWithMunin_1_original.png 493w, https:\/\/blog.janprunk.com\/wp-content\/uploads\/2015\/09\/MonitorBindWithMunin_1_original-273x300.png 273w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/a><a href=\"http:\/\/blog.prunk.si\/wp-uploads\/\/2015\/09\/MonitorBindWithMunin_2_original.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-819\" src=\"http:\/\/blog.prunk.si\/wp-uploads\/\/2015\/09\/MonitorBindWithMunin_2_original.png\" alt=\"MonitorBindWithMunin_2_original\" width=\"493\" height=\"346\" srcset=\"https:\/\/blog.janprunk.com\/wp-content\/uploads\/2015\/09\/MonitorBindWithMunin_2_original.png 493w, https:\/\/blog.janprunk.com\/wp-content\/uploads\/2015\/09\/MonitorBindWithMunin_2_original-300x211.png 300w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/a><\/strong><\/pre>\n<pre><\/pre>\n<pre><strong>\u00c2\u00a0<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;t cover Munin or Bind installation, only the manual how to sync those two together to display queries from Bind inside Munin, here [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,12],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=\/wp\/v2\/posts\/810"}],"collection":[{"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=810"}],"version-history":[{"count":10,"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=\/wp\/v2\/posts\/810\/revisions"}],"predecessor-version":[{"id":1218,"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=\/wp\/v2\/posts\/810\/revisions\/1218"}],"wp:attachment":[{"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.janprunk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}