2007-05-10 16:31:40 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Plugin to monitor pure-ftpd status
|
|
|
|
#
|
|
|
|
# (c) Julien Danjou <julien@danjou.info>
|
|
|
|
#
|
|
|
|
# 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:
|
2014-12-05 00:37:42 +01:00
|
|
|
# Maybe need to add following lines to plugins config file
|
2007-05-10 16:31:40 +02:00
|
|
|
# (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'
|
2017-02-24 04:26:39 +01:00
|
|
|
echo 'graph_category network'
|
2007-05-10 16:31:40 +02:00
|
|
|
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'
|