mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
Category Tree: Reduce number of categories
power5 -> cpu directories for different ftp servers
This commit is contained in:
parent
68bb709de6
commit
c3e309c6a5
15 changed files with 9 additions and 9 deletions
104
plugins/vsftpd/vsftpd
Executable file
104
plugins/vsftpd/vsftpd
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/bin/bash
|
||||
|
||||
logfile=${logfile:-/var/log/vsftpd.log}
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -f "${logfile}" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
cat <<EOF
|
||||
graph_title vsftpd Server
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel Requests
|
||||
graph_category ftp
|
||||
ftp_c.label connections
|
||||
ftp_c.type DERIVE
|
||||
ftp_c.min 0
|
||||
ftp_sl.label successful_logins
|
||||
ftp_sl.type DERIVE
|
||||
ftp_sl.min 0
|
||||
ftp_fl.label failed_logins
|
||||
ftp_fl.type DERIVE
|
||||
ftp_fl.min 0
|
||||
ftp_su.label successful_uploads
|
||||
ftp_su.type DERIVE
|
||||
ftp_su.min 0
|
||||
ftp_fu.label failed_uploads
|
||||
ftp_fu.type DERIVE
|
||||
ftp_fu.min 0
|
||||
ftp_sd.label successful_downloads
|
||||
ftp_sd.type DERIVE
|
||||
ftp_sd.min 0
|
||||
ftp_fd.label failed_downloads
|
||||
ftp_fd.type DERIVE
|
||||
ftp_fd.min 0
|
||||
ftp_sr.label successful_renames
|
||||
ftp_sr.type DERIVE
|
||||
ftp_sr.min 0
|
||||
ftp_fr.label failed_renames
|
||||
ftp_fr.type DERIVE
|
||||
ftp_fr.min 0
|
||||
ftp_sde.label successful_deletes
|
||||
ftp_sde.type DERIVE
|
||||
ftp_sde.min 0
|
||||
ftp_fde.label failed_deletes
|
||||
ftp_fde.type DERIVE
|
||||
ftp_fde.min 0
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "${logfile}" ]; then
|
||||
awk '
|
||||
BEGIN {
|
||||
counts["ftp_c"] = 0;
|
||||
counts["ftp_sl"] = 0;
|
||||
counts["ftp_fl"] = 0;
|
||||
counts["ftp_su"] = 0;
|
||||
counts["ftp_fu"] = 0;
|
||||
counts["ftp_sd"] = 0;
|
||||
counts["ftp_fd"] = 0;
|
||||
counts["ftp_sr"] = 0;
|
||||
counts["ftp_fr"] = 0;
|
||||
counts["ftp_sde"] = 0;
|
||||
counts["ftp_fde"] = 0;
|
||||
}
|
||||
/CONNECT/ { counts["ftp_c"]++; next; }
|
||||
/OK LOGIN/ { counts["ftp_sl"]++; next; }
|
||||
/FAIL LOGIN/ { counts["ftp_fl"]++; next; }
|
||||
/OK UPLOAD/ { counts["ftp_su"]++; next; }
|
||||
/FAIL UPLOAD/ { counts["ftp_fu"]++; next; }
|
||||
/OK DOWNLOAD/ { counts["ftp_sd"]++; next; }
|
||||
/FAIL DOWNLOAD/ { counts["ftp_fd"]++; next; }
|
||||
/OK RENAME/ { counts["ftp_sr"]++; next; }
|
||||
/FAIL RENAME/ { counts["ftp_fr"]++; next; }
|
||||
/OK DELETE/ { counts["ftp_sde"]++; next; }
|
||||
/FAIL DELETE/ { counts["ftp_fde"]++; next; }
|
||||
END {
|
||||
for (idx in counts) {
|
||||
printf "%s.value %d\n", idx, counts[idx];
|
||||
}
|
||||
}
|
||||
' "${logfile}"
|
||||
else
|
||||
cat <<EOF
|
||||
ftp_c.value U
|
||||
ftp_sl.value U
|
||||
ftp_fl.value U
|
||||
ftp_su.value U
|
||||
ftp_fu.value U
|
||||
ftp_sd.value U
|
||||
ftp_fd.value U
|
||||
ftp_sr.value U
|
||||
ftp_fr.value U
|
||||
ftp_sde.value U
|
||||
ftp_fde.value U
|
||||
EOF
|
||||
fi
|
112
plugins/vsftpd/vsftpd-rel
Executable file
112
plugins/vsftpd/vsftpd-rel
Executable file
|
@ -0,0 +1,112 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Copyright (C) 2008 Joey Schulze <joey@infodrom.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 dated June, 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
||||
|
||||
# Source: http://www.infodrom.org/Infodrom/tools/munin.html
|
||||
|
||||
# Supported configuration:
|
||||
#
|
||||
# [vsftpd-rel]
|
||||
# user root
|
||||
# env.logfile /var/log/vsftpd.log
|
||||
# env.logtail /usr/bin/logtail
|
||||
|
||||
PROGNAME=vsftpd
|
||||
STATEDIR=/var/lib/munin/plugin-state
|
||||
|
||||
LOGFILE=${logfile:-/var/log/vsftpd.log}
|
||||
LOGTAIL=${logtail:-`which logtail`}
|
||||
|
||||
OFFSET=${STATEDIR}/${PROGNAME}.offset
|
||||
STATE=${STATEDIR}/${PROGNAME}.state
|
||||
PIVOT=${STATEDIR}/${PROGNAME}.pivot
|
||||
|
||||
|
||||
install_ok()
|
||||
{
|
||||
tempfile=$(which tempfile)
|
||||
if [ ! -r ${LOGFILE} -o \
|
||||
-z "${LOGTAIL}" -o ! -x "${LOGTAIL}" -o \
|
||||
-z "${tempfile}" -o ! -x "${tempfile}" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "$1" = "autoconf" ]
|
||||
then
|
||||
tmpfile=`which tempfile`
|
||||
if install_ok
|
||||
then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]
|
||||
then
|
||||
echo 'system.type ABSOLUTE'
|
||||
echo 'graph_title Very Secure FTP Server'
|
||||
echo 'graph_vlabel Requests'
|
||||
echo 'graph_category FTP'
|
||||
echo 'ftp_conn.label connections'
|
||||
echo 'ftp_loginok.label successful logins'
|
||||
echo 'ftp_loginfail.label failed logins'
|
||||
echo 'ftp_uploadok.label successful uploads'
|
||||
echo 'ftp_uploadfail.label failed uploads'
|
||||
echo 'ftp_downloadok.label successful downloads'
|
||||
echo 'ftp_downloadfail.label failed downloads'
|
||||
echo 'ftp_deleteok.label successful deletes'
|
||||
echo 'ftp_deletefail.label failed deletes'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
test install_ok || exit 1
|
||||
|
||||
touch -d now-5minutes+30seconds $PIVOT
|
||||
TEMP=`tempfile`
|
||||
trap "rm -f ${PIVOT} ${TEMP}" INT EXIT
|
||||
|
||||
test -n "$TEMP" -a -w "$TEMP" || exit 1
|
||||
|
||||
if [ ! -s ${OFFSET} ]
|
||||
then
|
||||
$LOGTAIL ${LOGFILE} ${OFFSET} > ${TEMP}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $STATE -ot $PIVOT ]
|
||||
then
|
||||
$LOGTAIL ${LOGFILE} ${OFFSET} > ${TEMP}
|
||||
echo -n > ${STATE}
|
||||
|
||||
echo "ftp_conn.value $(grep 'CONNECT' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_loginok.value $(grep 'OK LOGIN' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_loginfail.value $(grep 'FAIL LOGIN' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_uploadok.value $(grep 'OK UPLOAD' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_uploadfail.value $(grep 'FAIL UPLOAD' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_downloadok.value $(grep 'OK DOWNLOAD' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_downloadfail.value $(grep 'FAIL DOWNLOAD' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_deleteok.value $(grep 'OK DELETE' ${TEMP} | wc -l)" >> $STATE
|
||||
echo "ftp_deletefail.value $(grep 'FAIL DELETE' ${TEMP} | wc -l)" >> $STATE
|
||||
fi
|
||||
|
||||
cat $STATE
|
Loading…
Add table
Add a link
Reference in a new issue