diff --git a/plugins/other/pure-ftpd b/plugins/other/pure-ftpd new file mode 100755 index 00000000..1a5efa72 --- /dev/null +++ b/plugins/other/pure-ftpd @@ -0,0 +1,77 @@ +#!/bin/sh +# +# Plugin to monitor pure-ftpd status +# +# (c) Julien Danjou +# +# GPLv2 licensed +# +# Parameters: +# +# config (required) +# autoconf (optional - used by munin-config) +# +# Config variables: +# +# spooldir - Override what exim says +# exim - Where's exim? +# queuewarn - When to warn +# queuecrit - When to crit +# +# Configuration: +# Maybe need to add folowing lines to plugins config file +# (e.g. /etc/munin/plugin-conf.d/pure-ftpd) to run pure-ftpwho +# as user with apropirate privilegs then restart munin-node. +# +# [pure-ftpd] +# user root +# +# 2008/02/01 - TMS +# - Little Configuration documentation +# - Added monitoring IDLE connections +# +# 2007/05/07 - jd +# First release +# +# Magic markers (optional - used by installation scripts and +# munin-config): +# +#%# family=contrib +#%# capabilities=autoconf + +PW=`which pure-ftpwho 2>/dev/null` +GRAPHTITLE='FTP connections' + +test -n "$pw" && PW=$pw +test -n "$graphtitle" && GRAPHTITLE=$graphtitle + +if [ "$1" = "autoconf" ]; then + if test -x $PW; then + echo yes + exit 0 + else + echo "no (pure-ftpwho not found)" + exit 0 + fi +fi + +if [ "$1" = "config" ]; then + echo "graph_title $GRAPHTITLE" + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel connections' + echo 'graph_category ftp' + echo 'upload.label Upload' + echo 'download.label Download' + echo 'idle.label Idle' + echo 'upload.draw AREA' + echo 'download.draw STACK' + echo 'idle.draw STACK' + exit 0 +fi + +printf "download.value " +$PW -n -s | grep -c ' DL ' +printf "upload.value " +$PW -n -s | grep -c ' UL ' +printf "idle.value " +$PW -n -s | grep -c 'IDLE'