/usr/share/munin/plugins/perdition is in munin-plugins-extra 2.0.37-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | #!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
perdition - Plugin to graph perdition connections and errors
=head1 CONFIGURATION
The following configuration variables are available for this plugin:
logfile - Log file to tail (default: "/var/log/perdition.log")
logtail - Path to logtail (default: "/usr/sbin/logtail")
=head1 DEPENDENCIES
Requires: logtail
=head1 AUTHOR
Copyright Micah Anderson <micah@riseup.net>
Jan 23, 2005
=head1 LICENSE
Unknown
=head1 MAGIC MARKERS
#%# family=contrib
#%# capabilities=autoconf
=head1 NOTES
# 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.
=cut
mktempfile () {
mktemp -p /tmp/ $1
}
# Set the location of the perdition logs
PERDITION_LOG=${logfile:-/var/log/perdition.log}
OFFSET_FILE=${MUNIN_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 0
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
# Echo warnnig and critical attributes if set in the plugin config
for i in imap imaps pop pops fatal connection disconnected; do
warn=\$${i}_warn; eval val=$warn
[ "$val" ] && echo "$i.warning ${val}"
crit=\$${i}_crit; eval val=$crit
[ "$val" ] && echo "$i.critical ${val}"
done
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}"
|