3
# Munin plugin for named. This is a bit experimental, we will have to see
4
# which statistics prove to have any meaning to get a feel with what happens
7
# Nicolai Langfeldt (janl@linpro.no) 27.8.2003
9
# Enviroment variables:
11
# logfile - set which log file to use
14
# Revision 1.1 2004/01/02 18:50:00 jimmyo
15
# Renamed occurrances of lrrd -> munin
17
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
18
# Import of LRRD CVS tree after renaming to Munin
20
# Revision 1.3 2003/11/26 15:57:21 jimmyo
21
# Milliqueries not of interest...
23
# Revision 1.2 2003/11/26 14:47:31 jimmyo
26
# Revision 1.1 2003/11/26 09:26:04 jimmyo
27
# Plugin contribution by Nicolai Langfeldt
32
# REQUIREMENTS: in your named.conf you must have statistics-interval set:
35
# statistics-interval 1;
38
# The number is in minutes. At each interval just 3 lines is dumped.
39
# It can be desturbing if you usually read the logs yourself, but
40
# a 1 minute interval ensures very updated information to munin.
41
# 5 minutes is the maximum I'd say.
43
# The name of the file where syslog puts daemon output - ie the named
44
# statistics output. On solaris this is /var/adm/messages, on most
45
# linuxes it is /var/log/messages. But on Debian it is
46
# /var/log/daemon which is read restricted so we have to run as a user
47
# with read rights, or remove the restrictions.
48
SYSLOGFILE=${logfile:-/var/adm/messages}
50
# ----------------------------------------------------------------------
53
ret=`echo "$2" | sed "s/.*$1=\([0-9]*\).*/\1/"`
63
if [ ! -f $SYSLOGFILE ] ; then
64
echo $SYSLOGFILE is unavailable to me >&2
68
# Get out the last XSTATS and NSTATS lines
69
XSTATS=`grep 'named.*XSTATS' "$SYSLOGFILE" | tail -1`
70
# NSTATS=`grep 'named.*NSTATS' "$SYSLOGFILE" | tail -1`
72
# We concentrate on what clients communicate with us about
73
# and counters that we suspect can indicate abuse or error conditions
75
# Received Queries: Total volume of queries received.
76
# This should be nice and smooth.
77
echo "queries.value `pick_stat RQ "$XSTATS"`"
79
# Sent Answers: This should be the same as RQ except when there are
80
# errors. May not be very interesting.
81
echo "answers.value `pick_stat SAns "$XSTATS"`"
83
# Sent and Forwarded queries, in a proxy setting this should be
84
# the same as Received Queries (?)
85
echo "forwarded.value `pick_stat SFwdQ "$XSTATS"`"
87
# Received Zone Transfer queries - should be low. High value could
88
# indicate some odd error or some kind of abuse
89
echo "axfr.value `pick_stat RAXFR "$XSTATS"`" # Received AXFR Qs
91
# Received TCP connections: These are used for zone transfers or
92
# oversized (>512 byte) answers. A high value here could indicate
93
# that you need to trim down the size of your answers somehow (Do you
94
# have a ton of MXes or NSes that gets reported back?), or this could
95
# be due to an error. Or it could be due to abuse.
96
echo "tcp.value `pick_stat RTCP "$XSTATS"`"
98
# Get a total of errors
100
`pick_stat RNXD "$XSTATS"` +
101
`pick_stat RFail "$XSTATS"` +
102
`pick_stat RErr "$XSTATS"` +
103
`pick_stat SErr "$XSTATS"` +
104
`pick_stat RIQ "$XSTATS"` +
105
`pick_stat RFErr "$XSTATS"` ";
107
echo "errors.value `expr $errexpr`"
113
graph_title BIND DNS Query statistics
114
graph_vlabel Queries / minute
116
queries.label Queries
119
queries.cdef queries,60,*
120
answers.label Answers
122
answers.cdef answers,60,*
124
forwarded.label Forwarded
125
forwarded.type DERIVE
126
forwarded.cdef forwarded,60,*
138
errors.cdef errors,60,*