2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/ftp/pure-ftpd
2017-02-24 04:26:39 +01:00

78 lines
1.6 KiB
Bash
Executable File

#!/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:
# Maybe need to add following 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 network'
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'