forked from linsomniac/munin-pdns_recursor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdns_rec_cache
executable file
·70 lines (60 loc) · 1.56 KB
/
pdns_rec_cache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
#
# pdns_recursor munin plugin.
# Written by Sean Reifschneider <[email protected]> 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
#
# Configuration variables:
#
# rec_control: Path to rec_control executable
# (default: /usr/bin/rec_control)
#
#%# family=auto
#%# capabilities=autoconf
REC_CONTROL="${rec_control:-/usr/bin/rec_control}"
if [ "$1" = "autoconf" ]; then
if [ -e "$REC_CONTROL" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
RESENDS=`"$REC_CONTROL" get cache-resends`
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'
echo 'graph_category pdns'
echo 'hits.label hits'
echo 'hits.min 0'
echo 'hits.max 1000000'
echo 'hits.type DERIVE'
echo 'hits.info Cache hits'
echo 'misses.label misses'
echo 'misses.min 0'
echo 'misses.max 1000000'
echo 'misses.type DERIVE'
echo 'misses.info Cache misses'
if [ "$RESENDS" != "UNKNOWN" ]; then
echo 'resends.label resends'
echo 'resends.min 0'
echo 'resends.max 1000000'
echo 'resends.type DERIVE'
echo 'resends.info Cache resends'
fi
exit 0
fi
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`
exit 0