|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/local/src/munin-1.2.6/node/node.d/ |
Upload File : |
#!/bin/sh
#
# Plugin to graph perdition connections and errors
# Requires: logtail
#
# Copyright Anderson <micah@riseup.net>
# Jan 23, 2005
#
#
#%# family=contrib
#%# capabilities=autoconf
# The different log lines we are interested in:
#
# buffy perdition[7583]: Connect: 64.45.82.181->69.50.164.185
# buffy perdition[20097]: Close: 217.19.50.108->69.50.74.154 user="mek" received=12 sent=23
# buffy perdition[7435]: Auth: 130.22.173.20->69.90.134.185 user="gotn" server="192.168.0.2" port="143" status="ok"
# buffy perdition[26986]: Auth: 72.13.2.186->69.92.134.215 user="moves" server="192.168.0.2" port="110" status="ok"
# Then there are some errors, I'm just going to put these all into one line, they could easily be
# separate out if we were interested in how many of each type of error, but 7 lines for this graph is a lot
# buffy perdition[20908]: Fatal Error reading authentication information from client "203.52.112.34->68.92.124.155": Exiting child
# buffy perdition[27754]: Fatal error establishing SSL connection to client
# buffy perdition[5139]: Fatal error negotiating setup. Exiting child.
mktempfile () {
@@MKTEMP@@
}
# Set the location of the perdition logs
PERDITION_LOG=${logfile:-/var/log/perdition.log}
OFFSET_FILE=@@PLUGSTATE@@/perdition.offset
LOGTAIL=${logtail:-/usr/sbin/logtail}
case $1 in
autoconf|detect)
if [ -f ${PERDITION_LOG} -a -x ${LOGTAIL} ]
then
echo yes
exit 0
else
echo "no (either $PERDITION_LOG was not found, or logtail was not in your path)"
exit 1
fi
;;
config)
cat <<EOF
graph_title Perdition Connections
graph_vlabel Number of Connections
graph_total Total
connection.label connections
disconnected.label disconnections
imap.label IMAP Auths
imaps.label IMAPS Auths
pop.label POP Auths
pops.label POPS Auths
fatal.label Fatal Errors
EOF
exit 0
;;
esac
ARGS=0
`$LOGTAIL /etc/hosts 2>/dev/null >/dev/null`
if [ $? = 66 ]; then
if [ ! -n "$logtail" ]; then
ARGS=1
fi
fi
TEMP_FILE=`mktempfile munin-perdition.XXXXXX`
if [ -z "$TEMP_FILE" -o ! -f "$TEMP_FILE" ]; then
exit 3
fi
if [ $ARGS != 0 ]; then
${LOGTAIL} -f ${PERDITION_LOG} -o ${OFFSET_FILE} > ${TEMP_FILE}
else
${LOGTAIL} ${PERDITION_LOG} ${OFFSET_FILE} > ${TEMP_FILE}
fi
connection=`grep "Connect:" ${TEMP_FILE} | wc -l`
disconnected=`grep "Close:" ${TEMP_FILE} | wc -l`
imap=`grep 'port="143" status="ok"' ${TEMP_FILE} | wc -l`
imaps=`grep 'port="993" status="ok"' ${TEMP_FILE} | wc -l`
pop=`grep 'port="110" status="ok"' ${TEMP_FILE} | wc -l`
pops=`grep 'port="995" status="ok"' ${TEMP_FILE} | wc -l`
fatal=`grep 'Fatal [e|E]rror' ${TEMP_FILE} | wc -l`
rm ${TEMP_FILE}
echo "connection.value ${connection}"
echo "disconnected.value ${disconnected}"
echo "imap.value ${imap}"
echo "imaps.value ${imaps}"
echo "pop.value ${pop}"
echo "pops.value ${pops}"
echo "fatal.value ${fatal}"