#!/bin/sh
#
# Script to monitor disk usage for given mountpoints.
#
# Parameters understood:
#
#       config   (required)
#       autoconf (optional - used by munin-config)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
SYMPA_SPOOL="${spool:-/opt/sympa/spool/}"
QUEUES="auth bounce digest distribute expire moderation msg outgoing subscribe task tmp topic msg/bad distribute/bad"
if [ "$1" = "autoconf" ]; then
        echo yes
fi

if [ "$1" = "config" ]; then
    echo 'graph_title Data in sympa-spool'
    echo 'graph_category sympa'

    for i in $QUEUES ; do echo $i.draw LINE2 |tr "/" "_" ; echo -n "$i.label" | tr "/" "_" ; echo " $i" ; done ;
    exit 0
fi


for i in $QUEUES ; do  COUNT=`find ${SYMPA_SPOOL}/$i -maxdepth 1 -type f|wc -l|tr -d " "`; echo $i.value $COUNT | tr "/" "_" ; done ;
