From 0d2b3037e602e3a8c249f8aee30949dc6b6b247c Mon Sep 17 00:00:00 2001 From: Fusl Date: Thu, 23 Jan 2014 09:59:58 +0100 Subject: [PATCH 1/3] Added plugin for pdns_recursor rec_control get-qtypelist querytype-listing which is going to be merged into a stable in the near future. --- plugins/network/dns/pdns_rec_qtypes | 280 ++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100755 plugins/network/dns/pdns_rec_qtypes diff --git a/plugins/network/dns/pdns_rec_qtypes b/plugins/network/dns/pdns_rec_qtypes new file mode 100755 index 00000000..743e72ae --- /dev/null +++ b/plugins/network/dns/pdns_rec_qtypes @@ -0,0 +1,280 @@ +#!/bin/sh +# +# pdns_recursor munin plugin. +# Written by Fusl 2014-01-23 +# Placed in the public domain +# +# Requires running as root: +# +# echo '[pdns_rec_*]' >/etc/munin/plugin-conf.d/pdns_rec +# echo 'user root' >>/etc/munin/plugin-conf.d/pdns_rec + +if [ "$1" = "autoconf" ]; then + if [ -e /usr/bin/rec_control ]; then + echo yes + exit 0 + else + echo no + exit 1 + fi +fi + +if [ "$1" = "config" ]; then + echo 'graph_title PDNS Recursor Query Types' + echo 'graph_order a ns cname soa mr ptr hinfo mx txt rp afsdb sig key aaaa loc srv naptr kx cert a6 opt ds sshfp ipseckey prsig nsec dnskey dhcid nsec3 nsec3param tlsa spf eui48 eui64 tsig ixfr axfr mailb maila any url mboxfw curl addr dlv' + echo 'graph_vlabel querytypes' + echo 'graph_info Querytype breakdown' + echo 'graph_category pdns' + + echo 'a.label A queries' + echo 'a.min 0' + echo 'a.type DERIVE' + echo 'a.info Queries with A type' + + echo 'ns.label NS queries' + echo 'ns.min 0' + echo 'ns.type DERIVE' + echo 'ns.info Queries with NS type' + + echo 'cname.label CNAME queries' + echo 'cname.min 0' + echo 'cname.type DERIVE' + echo 'cname.info Queries with CNAME type' + + echo 'soa.label SOA queries' + echo 'soa.min 0' + echo 'soa.type DERIVE' + echo 'soa.info Queries with SOA type' + + echo 'mr.label MR queries' + echo 'mr.min 0' + echo 'mr.type DERIVE' + echo 'mr.info Queries with MR type' + + echo 'ptr.label PTR queries' + echo 'ptr.min 0' + echo 'ptr.type DERIVE' + echo 'ptr.info Queries with PTR type' + + echo 'hinfo.label HINFO queries' + echo 'hinfo.min 0' + echo 'hinfo.type DERIVE' + echo 'hinfo.info Queries with HINFO type' + + echo 'mx.label MX queries' + echo 'mx.min 0' + echo 'mx.type DERIVE' + echo 'mx.info Queries with MX type' + + echo 'txt.label TXT queries' + echo 'txt.min 0' + echo 'txt.type DERIVE' + echo 'txt.info Queries with TXT type' + + echo 'rp.label RP queries' + echo 'rp.min 0' + echo 'rp.type DERIVE' + echo 'rp.info Queries with RP type' + + echo 'afsdb.label AFSDB queries' + echo 'afsdb.min 0' + echo 'afsdb.type DERIVE' + echo 'afsdb.info Queries with AFSDB type' + + echo 'sig.label SIG queries' + echo 'sig.min 0' + echo 'sig.type DERIVE' + echo 'sig.info Queries with SIG type' + + echo 'key.label KEY queries' + echo 'key.min 0' + echo 'key.type DERIVE' + echo 'key.info Queries with KEY type' + + echo 'aaaa.label AAAA queries' + echo 'aaaa.min 0' + echo 'aaaa.type DERIVE' + echo 'aaaa.info Queries with AAAA type' + + echo 'loc.label LOC queries' + echo 'loc.min 0' + echo 'loc.type DERIVE' + echo 'loc.info Queries with LOC type' + + echo 'srv.label SRV queries' + echo 'srv.min 0' + echo 'srv.type DERIVE' + echo 'srv.info Queries with SRV type' + + echo 'naptr.label NAPTR queries' + echo 'naptr.min 0' + echo 'naptr.type DERIVE' + echo 'naptr.info Queries with NAPTR type' + + echo 'kx.label KX queries' + echo 'kx.min 0' + echo 'kx.type DERIVE' + echo 'kx.info Queries with KX type' + + echo 'cert.label CERT queries' + echo 'cert.min 0' + echo 'cert.type DERIVE' + echo 'cert.info Queries with CERT type' + + echo 'a6.label A6 queries' + echo 'a6.min 0' + echo 'a6.type DERIVE' + echo 'a6.info Queries with A6 type' + + echo 'opt.label OPT queries' + echo 'opt.min 0' + echo 'opt.type DERIVE' + echo 'opt.info Queries with OPT type' + + echo 'ds.label DS queries' + echo 'ds.min 0' + echo 'ds.type DERIVE' + echo 'ds.info Queries with DS type' + + echo 'sshfp.label SSHFP queries' + echo 'sshfp.min 0' + echo 'sshfp.type DERIVE' + echo 'sshfp.info Queries with SSHFP type' + + echo 'ipseckey.label IPSECKEY queries' + echo 'ipseckey.min 0' + echo 'ipseckey.type DERIVE' + echo 'ipseckey.info Queries with IPSECKEY type' + + echo 'prsig.label PRSIG queries' + echo 'prsig.min 0' + echo 'prsig.type DERIVE' + echo 'prsig.info Queries with PRSIG type' + + echo 'nsec.label NSEC queries' + echo 'nsec.min 0' + echo 'nsec.type DERIVE' + echo 'nsec.info Queries with NSEC type' + + echo 'dnskey.label DNSKEY queries' + echo 'dnskey.min 0' + echo 'dnskey.type DERIVE' + echo 'dnskey.info Queries with DNSKEY type' + + echo 'dhcid.label DHCID queries' + echo 'dhcid.min 0' + echo 'dhcid.type DERIVE' + echo 'dhcid.info Queries with DHCID type' + + echo 'nsec3.label NSEC3 queries' + echo 'nsec3.min 0' + echo 'nsec3.type DERIVE' + echo 'nsec3.info Queries with NSEC3 type' + + echo 'nsec3param.label NSEC3PARAM queries' + echo 'nsec3param.min 0' + echo 'nsec3param.type DERIVE' + echo 'nsec3param.info Queries with NSEC3PARAM type' + + echo 'tlsa.label TLSA queries' + echo 'tlsa.min 0' + echo 'tlsa.type DERIVE' + echo 'tlsa.info Queries with TLSA type' + + echo 'spf.label SPF queries' + echo 'spf.min 0' + echo 'spf.type DERIVE' + echo 'spf.info Queries with SPF type' + + echo 'eui48.label EUI48 queries' + echo 'eui48.min 0' + echo 'eui48.type DERIVE' + echo 'eui48.info Queries with EUI48 type' + + echo 'eui64.label EUI64 queries' + echo 'eui64.min 0' + echo 'eui64.type DERIVE' + echo 'eui64.info Queries with EUI64 type' + + echo 'tsig.label TSIG queries' + echo 'tsig.min 0' + echo 'tsig.type DERIVE' + echo 'tsig.info Queries with TSIG type' + + echo 'ixfr.label IXFR queries' + echo 'ixfr.min 0' + echo 'ixfr.type DERIVE' + echo 'ixfr.info Queries with IXFR type' + + echo 'axfr.label AXFR queries' + echo 'axfr.min 0' + echo 'axfr.type DERIVE' + echo 'axfr.info Queries with AXFR type' + + echo 'mailb.label MAILB queries' + echo 'mailb.min 0' + echo 'mailb.type DERIVE' + echo 'mailb.info Queries with MAILB type' + + echo 'maila.label MAILA queries' + echo 'maila.min 0' + echo 'maila.type DERIVE' + echo 'maila.info Queries with MAILA type' + + echo 'any.label ANY queries' + echo 'any.min 0' + echo 'any.type DERIVE' + echo 'any.info Queries with ANY type' + + echo 'url.label URL queries' + echo 'url.min 0' + echo 'url.type DERIVE' + echo 'url.info Queries with URL type' + + echo 'mboxfw.label MBOXFW queries' + echo 'mboxfw.min 0' + echo 'mboxfw.type DERIVE' + echo 'mboxfw.info Queries with MBOXFW type' + + echo 'curl.label CURL queries' + echo 'curl.min 0' + echo 'curl.type DERIVE' + echo 'curl.info Queries with CURL type' + + echo 'addr.label ADDR queries' + echo 'addr.min 0' + echo 'addr.type DERIVE' + echo 'addr.info Queries with ADDR type' + + echo 'dlv.label DLV queries' + echo 'dlv.min 0' + echo 'dlv.type DERIVE' + echo 'dlv.info Queries with DLV type' + + echo 'unk.label Unknown type queries' + echo 'unk.min 0' + echo 'unk.type DERIVE' + echo 'unk.info Queries with unknown type' + + exit 0 +fi + +awkscript=' +BEGIN { + unk=0 +} +{ + if (substr($1, 0, 4) == "TYPE") { + unk += ($2+0); + } else { + print tolower($1)".value "$2; + } +}; +END { + print "unk.value "unk; +} +' + +rec_control get-qtypelist | awk "$awkscript" + +exit 0 \ No newline at end of file From 9e884a354663aacb2c7c9980a85d47daf3646251 Mon Sep 17 00:00:00 2001 From: Fusl Date: Thu, 23 Jan 2014 10:13:47 +0100 Subject: [PATCH 2/3] Made a typo at RRSIG (was: PRSIG) --- plugins/network/dns/pdns_rec_qtypes | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/network/dns/pdns_rec_qtypes b/plugins/network/dns/pdns_rec_qtypes index 743e72ae..f1b63813 100755 --- a/plugins/network/dns/pdns_rec_qtypes +++ b/plugins/network/dns/pdns_rec_qtypes @@ -21,7 +21,7 @@ fi if [ "$1" = "config" ]; then echo 'graph_title PDNS Recursor Query Types' - echo 'graph_order a ns cname soa mr ptr hinfo mx txt rp afsdb sig key aaaa loc srv naptr kx cert a6 opt ds sshfp ipseckey prsig nsec dnskey dhcid nsec3 nsec3param tlsa spf eui48 eui64 tsig ixfr axfr mailb maila any url mboxfw curl addr dlv' + echo 'graph_order a ns cname soa mr ptr hinfo mx txt rp afsdb sig key aaaa loc srv naptr kx cert a6 opt ds sshfp ipseckey rrsig nsec dnskey dhcid nsec3 nsec3param tlsa spf eui48 eui64 tsig ixfr axfr mailb maila any url mboxfw curl addr dlv' echo 'graph_vlabel querytypes' echo 'graph_info Querytype breakdown' echo 'graph_category pdns' @@ -146,10 +146,10 @@ if [ "$1" = "config" ]; then echo 'ipseckey.type DERIVE' echo 'ipseckey.info Queries with IPSECKEY type' - echo 'prsig.label PRSIG queries' - echo 'prsig.min 0' - echo 'prsig.type DERIVE' - echo 'prsig.info Queries with PRSIG type' + echo 'rrsig.label RRSIG queries' + echo 'rrsig.min 0' + echo 'rrsig.type DERIVE' + echo 'rrsig.info Queries with RRSIG type' echo 'nsec.label NSEC queries' echo 'nsec.min 0' From a4d97861c25115fc147274d149f636df19aeb16b Mon Sep 17 00:00:00 2001 From: Fusl Date: Thu, 23 Jan 2014 10:21:00 +0100 Subject: [PATCH 3/3] Removed OPT, IXFR, AXFR, URL, MBOXFW and CURL as they aren't being used in pdns_recursor --- plugins/network/dns/pdns_rec_qtypes | 32 +---------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/plugins/network/dns/pdns_rec_qtypes b/plugins/network/dns/pdns_rec_qtypes index f1b63813..03744804 100755 --- a/plugins/network/dns/pdns_rec_qtypes +++ b/plugins/network/dns/pdns_rec_qtypes @@ -21,7 +21,7 @@ fi if [ "$1" = "config" ]; then echo 'graph_title PDNS Recursor Query Types' - echo 'graph_order a ns cname soa mr ptr hinfo mx txt rp afsdb sig key aaaa loc srv naptr kx cert a6 opt ds sshfp ipseckey rrsig nsec dnskey dhcid nsec3 nsec3param tlsa spf eui48 eui64 tsig ixfr axfr mailb maila any url mboxfw curl addr dlv' + echo 'graph_order a ns cname soa mr ptr hinfo mx txt rp afsdb sig key aaaa loc srv naptr kx cert a6 ds sshfp ipseckey rrsig nsec dnskey dhcid nsec3 nsec3param tlsa spf eui48 eui64 tsig mailb maila any dlv' echo 'graph_vlabel querytypes' echo 'graph_info Querytype breakdown' echo 'graph_category pdns' @@ -126,11 +126,6 @@ if [ "$1" = "config" ]; then echo 'a6.type DERIVE' echo 'a6.info Queries with A6 type' - echo 'opt.label OPT queries' - echo 'opt.min 0' - echo 'opt.type DERIVE' - echo 'opt.info Queries with OPT type' - echo 'ds.label DS queries' echo 'ds.min 0' echo 'ds.type DERIVE' @@ -201,16 +196,6 @@ if [ "$1" = "config" ]; then echo 'tsig.type DERIVE' echo 'tsig.info Queries with TSIG type' - echo 'ixfr.label IXFR queries' - echo 'ixfr.min 0' - echo 'ixfr.type DERIVE' - echo 'ixfr.info Queries with IXFR type' - - echo 'axfr.label AXFR queries' - echo 'axfr.min 0' - echo 'axfr.type DERIVE' - echo 'axfr.info Queries with AXFR type' - echo 'mailb.label MAILB queries' echo 'mailb.min 0' echo 'mailb.type DERIVE' @@ -226,21 +211,6 @@ if [ "$1" = "config" ]; then echo 'any.type DERIVE' echo 'any.info Queries with ANY type' - echo 'url.label URL queries' - echo 'url.min 0' - echo 'url.type DERIVE' - echo 'url.info Queries with URL type' - - echo 'mboxfw.label MBOXFW queries' - echo 'mboxfw.min 0' - echo 'mboxfw.type DERIVE' - echo 'mboxfw.info Queries with MBOXFW type' - - echo 'curl.label CURL queries' - echo 'curl.min 0' - echo 'curl.type DERIVE' - echo 'curl.info Queries with CURL type' - echo 'addr.label ADDR queries' echo 'addr.min 0' echo 'addr.type DERIVE'