Repository
Munin (contrib)
Last change
2018-08-02
Graph Categories
Keywords
Language
Shell

pdns_rec_qtypes

Sadly there is no documentation for this plugin.

#!/bin/sh
#
#  pdns_recursor munin plugin.
#  Written by Fusl <root@sigqu.it> 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

rec_control="/usr/bin/rec_control"

if [ "$1" = "autoconf" ]; then
	if [ -e "$rec_control" ]; then
		echo yes
		exit 0
	else
		echo "no (missing $rec_control)"
		exit 0
	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 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 dns'

	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 '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 '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'
	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 '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 '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