Révision c7695b31
Initial version
| plugins/other/pure-ftpd-logs | ||
|---|---|---|
| 1 |
#!/bin/bash |
|
| 2 |
# |
|
| 3 |
# |
|
| 4 |
# pure-ftpd plugin |
|
| 5 |
# show what the users did on your ftp server |
|
| 6 |
# made by Dju |
|
| 7 |
# |
|
| 8 |
# commands needed: logtail - grep |
|
| 9 |
# |
|
| 10 |
# |
|
| 11 |
# Parameters |
|
| 12 |
# |
|
| 13 |
# config (required) |
|
| 14 |
# autoconf (optional - used by munin-config) |
|
| 15 |
# |
|
| 16 |
# |
|
| 17 |
# Magic markers (optional - used by munin-config and installation scripts): |
|
| 18 |
# |
|
| 19 |
#%# family=auto |
|
| 20 |
#%# capabilities=autoconf |
|
| 21 |
|
|
| 22 |
|
|
| 23 |
LOGFILE=/var/log/syslog |
|
| 24 |
LOGTAIL=$(which logtail) |
|
| 25 |
OFFSET_FILE=/var/lib/munin/plugin-state/pure-ftpd-conns.offset |
|
| 26 |
|
|
| 27 |
|
|
| 28 |
if [ "$1" = "autoconf" ]; then |
|
| 29 |
if [ -f $LOGFILE ]; then |
|
| 30 |
if [ ! -z "$LOGTAIL" -a -f $LOGTAIL -a -x $LOGTAIL ]; then |
|
| 31 |
echo yes |
|
| 32 |
exit 0 |
|
| 33 |
else |
|
| 34 |
echo "no (logtail not found)" |
|
| 35 |
exit 1 |
|
| 36 |
fi |
|
| 37 |
else |
|
| 38 |
echo "no (logfile ${LOGFILE} does not exist)"
|
|
| 39 |
exit 1 |
|
| 40 |
fi |
|
| 41 |
fi |
|
| 42 |
|
|
| 43 |
if [ "$1" = "config" ]; then |
|
| 44 |
echo 'graph_title Pure Ftpd Logs' |
|
| 45 |
echo 'graph_args --base 1000 -l 0' |
|
| 46 |
echo 'graph_vlabel Connections number' |
|
| 47 |
echo 'graph_category pure-ftp' |
|
| 48 |
echo 'nc.label new connection' |
|
| 49 |
echo 'al.label anonymous logged' |
|
| 50 |
echo 'ul.label auth user logged' |
|
| 51 |
echo 'af.label auth failed' |
|
| 52 |
echo 'to.label timeout' |
|
| 53 |
echo 'dl.label download' |
|
| 54 |
echo 'upl.label upload' |
|
| 55 |
exit 0 |
|
| 56 |
fi |
|
| 57 |
|
|
| 58 |
TMP1=`mktemp` |
|
| 59 |
$LOGTAIL -o $OFFSET_FILE $LOGFILE | grep ' pure-ftpd: ' > $TMP1 |
|
| 60 |
|
|
| 61 |
echo -en "nc.value " |
|
| 62 |
grep '\[INFO\] New connection from ' $TMP1 | wc -l |
|
| 63 |
|
|
| 64 |
echo -en "al.value " |
|
| 65 |
grep '\[INFO\] Anonymous user logged in' $TMP1 | wc -l |
|
| 66 |
|
|
| 67 |
echo -en "ul.value " |
|
| 68 |
grep '\[INFO\] .*is now logged in' $TMP1 | wc -l |
|
| 69 |
|
|
| 70 |
echo -en "to.value " |
|
| 71 |
grep ' Timeout ' $TMP1 | wc -l |
|
| 72 |
|
|
| 73 |
echo -en "af.value " |
|
| 74 |
grep '\[WARNING\] Authentication failed' $TMP1 | wc -l |
|
| 75 |
|
|
| 76 |
echo -en "dl.value " |
|
| 77 |
grep '\[NOTICE\].* downloaded ' $TMP1 | wc -l |
|
| 78 |
|
|
| 79 |
echo -en "upl.value " |
|
| 80 |
grep '\[NOTICE\].* uploaded ' $TMP1 | wc -l |
|
| 81 |
|
|
| 82 |
rm $TMP1 |
|
| 83 |
|
|
Formats disponibles : Unified diff