🩺: add nsd plugin to munin
This commit is contained in:
127
roles/munin_client/files/nsd
Normal file
127
roles/munin_client/files/nsd
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
: << =cut
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
nsd - Plugin to monitor nsd DNS server
|
||||||
|
|
||||||
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
|
No configuration
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Kim Heino <b@bbbs.net>
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
GPLv2
|
||||||
|
|
||||||
|
=head1 MAGIC MARKERS
|
||||||
|
|
||||||
|
#%# family=auto
|
||||||
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
if [ "$1" = "autoconf" ]; then
|
||||||
|
if [ -x /usr/sbin/nsd-control ]; then
|
||||||
|
echo "yes"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "no (no /usr/sbin/nsd-control)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "config" ]; then
|
||||||
|
echo 'graph_title NSD queries'
|
||||||
|
echo 'graph_vlabel queries / second'
|
||||||
|
echo 'graph_category dns'
|
||||||
|
echo 'graph_info Queries per second, by query type'
|
||||||
|
echo 'a.label A'
|
||||||
|
echo 'a.type DERIVE'
|
||||||
|
echo 'a.min 0'
|
||||||
|
echo 'aaaa.label AAAA'
|
||||||
|
echo 'aaaa.type DERIVE'
|
||||||
|
echo 'aaaa.min 0'
|
||||||
|
echo 'ptr.label PTR'
|
||||||
|
echo 'ptr.type DERIVE'
|
||||||
|
echo 'ptr.min 0'
|
||||||
|
echo 'cname.label CNAME'
|
||||||
|
echo 'cname.type DERIVE'
|
||||||
|
echo 'cname.min 0'
|
||||||
|
echo 'mx.label MX'
|
||||||
|
echo 'mx.type DERIVE'
|
||||||
|
echo 'mx.min 0'
|
||||||
|
echo 'txt.label TXT'
|
||||||
|
echo 'txt.type DERIVE'
|
||||||
|
echo 'txt.min 0'
|
||||||
|
echo 'soa.label SOA'
|
||||||
|
echo 'soa.type DERIVE'
|
||||||
|
echo 'soa.min 0'
|
||||||
|
echo 'ns.label NS'
|
||||||
|
echo 'ns.type DERIVE'
|
||||||
|
echo 'ns.min 0'
|
||||||
|
echo 'srv.label SRV'
|
||||||
|
echo 'srv.type DERIVE'
|
||||||
|
echo 'srv.min 0'
|
||||||
|
echo 'dnskey.label DNSKEY'
|
||||||
|
echo 'dnskey.type DERIVE'
|
||||||
|
echo 'dnskey.min 0'
|
||||||
|
echo 'axfr.label AXFR'
|
||||||
|
echo 'axfr.type DERIVE'
|
||||||
|
echo 'axfr.min 0'
|
||||||
|
echo 'snxd.label NXDOMAIN'
|
||||||
|
echo 'snxd.type DERIVE'
|
||||||
|
echo 'snxd.min 0'
|
||||||
|
echo 'rq.label Total Successful'
|
||||||
|
echo 'rq.type DERIVE'
|
||||||
|
echo 'rq.min 0'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/sbin/nsd-control stats_noreset | sed 's/=/ /; s/\.//g' | (
|
||||||
|
numtypeA=0
|
||||||
|
numtypeAAAA=0
|
||||||
|
numtypePTR=0
|
||||||
|
numtypeCNAME=0
|
||||||
|
numtypeMX=0
|
||||||
|
numtypeTXT=0
|
||||||
|
numtypeSOA=0
|
||||||
|
numtypeNS=0
|
||||||
|
numtypeSRV=0
|
||||||
|
numtypeDNSKEY=0
|
||||||
|
numraxfr=0
|
||||||
|
numrcodeNXDOMAIN=0
|
||||||
|
numqueries=0
|
||||||
|
while read -r key value rest; do
|
||||||
|
[ "${key}" = "numtypeA" ] && numtypeA=${value}
|
||||||
|
[ "${key}" = "numtypeAAAA" ] && numtypeAAAA=${value}
|
||||||
|
[ "${key}" = "numtypePTR" ] && numtypePTR=${value}
|
||||||
|
[ "${key}" = "numtypeCNAME" ] && numtypeCNAME=${value}
|
||||||
|
[ "${key}" = "numtypeMX" ] && numtypeMX=${value}
|
||||||
|
[ "${key}" = "numtypeTXT" ] && numtypeTXT=${value}
|
||||||
|
[ "${key}" = "numtypeSOA" ] && numtypeSOA=${value}
|
||||||
|
[ "${key}" = "numtypeNS" ] && numtypeNS=${value}
|
||||||
|
[ "${key}" = "numtypeSRV" ] && numtypeSRV=${value}
|
||||||
|
[ "${key}" = "numtypeDNSKEY" ] && numtypeDNSKEY=${value}
|
||||||
|
[ "${key}" = "numraxfr" ] && numraxfr=${value}
|
||||||
|
[ "${key}" = "numrcodeNXDOMAIN" ] && numrcodeNXDOMAIN=${value}
|
||||||
|
[ "${key}" = "numqueries" ] && numqueries=${value}
|
||||||
|
done
|
||||||
|
echo "a.value ${numtypeA}"
|
||||||
|
echo "aaaa.value ${numtypeAAAA}"
|
||||||
|
echo "ptr.value ${numtypePTR}"
|
||||||
|
echo "cname.value ${numtypeCNAME}"
|
||||||
|
echo "mx.value ${numtypeMX}"
|
||||||
|
echo "txt.value ${numtypeTXT}"
|
||||||
|
echo "soa.value ${numtypeSOA}"
|
||||||
|
echo "ns.value ${numtypeNS}"
|
||||||
|
echo "srv.value ${numtypeSRV}"
|
||||||
|
echo "dnskey.value ${numtypeDNSKEY}"
|
||||||
|
echo "axfr.value ${numraxfr}"
|
||||||
|
echo "snxd.value ${numrcodeNXDOMAIN}"
|
||||||
|
echo "rq.value ${numqueries}"
|
||||||
|
)
|
@@ -120,3 +120,8 @@
|
|||||||
- name: Execute specific garage commands
|
- name: Execute specific garage commands
|
||||||
ansible.builtin.include_tasks: garage.yml
|
ansible.builtin.include_tasks: garage.yml
|
||||||
when: "'garage1' in inventory_hostname"
|
when: "'garage1' in inventory_hostname"
|
||||||
|
|
||||||
|
# Specific nsd commands
|
||||||
|
- name: Execute specific nsd commands
|
||||||
|
ansible.builtin.include_tasks: nsd.yml
|
||||||
|
when: "'dns' in inventory_hostname"
|
||||||
|
21
roles/munin_client/tasks/nsd.yml
Normal file
21
roles/munin_client/tasks/nsd.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Put nsd plugin configuration
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: nsd.j2
|
||||||
|
dest: /etc/munin/plugin-conf.d/nsd
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0o640"
|
||||||
|
notify:
|
||||||
|
- Restart munin-node
|
||||||
|
|
||||||
|
- name: Put nsd scripts
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: files/nsd
|
||||||
|
dest: /etc/munin/plugins/nsd
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0o755"
|
||||||
|
notify:
|
||||||
|
- Restart munin-node
|
2
roles/munin_client/templates/nsd.j2
Normal file
2
roles/munin_client/templates/nsd.j2
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[nsd]
|
||||||
|
user root
|
Reference in New Issue
Block a user