2009-12-10 13:52:41 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# pdns_recursor munin plugin.
|
|
|
|
# Written by Sean Reifschneider <jafo@tummy.com> 2009-12-03
|
|
|
|
# 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
|
|
|
|
|
2017-09-29 10:20:40 +02:00
|
|
|
rec_control="/usr/bin/rec_control"
|
|
|
|
|
2009-12-10 13:52:41 +01:00
|
|
|
if [ "$1" = "autoconf" ]; then
|
2017-09-29 10:20:40 +02:00
|
|
|
if [ -e "$rec_control" ]; then
|
2009-12-10 13:52:41 +01:00
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
else
|
2017-09-29 10:20:40 +02:00
|
|
|
echo "no (missing $rec_control)"
|
|
|
|
exit 0
|
2009-12-10 13:52:41 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-09-29 10:20:40 +02:00
|
|
|
RESENDS="$($rec_control get cache-resends)"
|
2009-12-10 13:52:41 +01:00
|
|
|
ISRESENDS=""
|
|
|
|
[ "$RESENDS" != "UNKNOWN" ] && ISRESENDS="resends"
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo 'graph_title PDNS Cache'
|
|
|
|
echo "graph_order hits misses $ISRESENDS"
|
|
|
|
echo 'graph_vlabel entries'
|
|
|
|
echo 'graph_info Hit/miss rate'
|
2017-02-22 00:30:20 +01:00
|
|
|
echo 'graph_category dns'
|
2009-12-10 13:52:41 +01:00
|
|
|
|
|
|
|
echo 'hits.label hits'
|
|
|
|
echo 'hits.min 0'
|
|
|
|
echo 'hits.max 100000'
|
|
|
|
echo 'hits.type COUNTER'
|
|
|
|
echo 'hits.info Cache hits'
|
|
|
|
|
|
|
|
echo 'misses.label misses'
|
|
|
|
echo 'misses.min 0'
|
|
|
|
echo 'misses.max 100000'
|
|
|
|
echo 'misses.type COUNTER'
|
|
|
|
echo 'misses.info Cache misses'
|
|
|
|
|
|
|
|
if [ "$RESENDS" != "UNKNOWN" ]; then
|
|
|
|
echo 'resends.label resends'
|
|
|
|
echo 'resends.min 0'
|
|
|
|
echo 'resends.max 100000'
|
|
|
|
echo 'resends.type COUNTER'
|
|
|
|
echo 'resends.info Cache resends'
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2017-09-29 10:20:40 +02:00
|
|
|
echo hits.value "$($rec_control get cache-hits)"
|
|
|
|
echo misses.value "$($rec_control get cache-misses)"
|
|
|
|
[ "$RESENDS" != "UNKNOWN" ] && echo resends.value "$($rec_control get cache-resends)"
|
2009-12-10 13:52:41 +01:00
|
|
|
|
|
|
|
exit 0
|