#!/bin/sh
#
# Plugin to monitor the Scalix email system: Queue statistics
#
# (C) 2008 P.Holzleitner
#
#
#%# family=contrib

OMSTAT="/opt/scalix/bin/omstat"

if [ "$1" = "config" ]; then

	echo 'graph_title Scalix queues'
	echo 'graph_args --lower-limit 0'
	echo 'graph_vlabel number'
	echo 'graph_category mail'

	echo 'archive.label Archive'
	echo 'bb.label Bulletin Board'
	echo 'dirsync.label Dir-Sync'

	echo 'error.label Error'
	echo "error.warning 1"
	echo "error.critical 10"

	echo 'local.label Local'
	echo "local.warning 50"
	echo "local.critical 100"

	echo 'router.label Router'
	echo "router.warning 50"
	echo "router.critical 100"

	echo 'smerr.label SM-Error'
	echo 'smintfc.label SM-Interface'
	echo 'unix.label Unix'

	echo 'poison.label Poison'
	echo "poison.warning 1"
	echo "poison.critical 10"
	exit 0
fi

#ARCHERR=`$OMSTAT -q archerr  2>/dev/null | wc -l`
ARCHIVE=`$OMSTAT -q archive  2>/dev/null | wc -l`
BB=`$OMSTAT -q bb  2>/dev/null | wc -l`
DIRSYNC=`$OMSTAT -q dirsync  2>/dev/null | wc -l`
#DMM=`$OMSTAT -q dmm  2>/dev/null | wc -l`
#DUMP=`$OMSTAT -q dump  2>/dev/null | wc -l`
#ERRMGR=`$OMSTAT -q errmgr  2>/dev/null | wc -l`
ERROR=`$OMSTAT -q error  2>/dev/null | wc -l`
#LICENSE=`$OMSTAT -q license  2>/dev/null | wc -l`
LOCAL=`$OMSTAT -q local  2>/dev/null | wc -l`
#PRINT=`$OMSTAT -q print  2>/dev/null | wc -l`
#REQ=`$OMSTAT -q req  2>/dev/null | wc -l`
#RESOLVE=`$OMSTAT -q resolve  2>/dev/null | wc -l`
ROUTER=`$OMSTAT -q router  2>/dev/null | wc -l`
SMERR=`$OMSTAT -q smerr  2>/dev/null | wc -l`
SMINTFC=`$OMSTAT -q smintfc  2>/dev/null | wc -l`
#TEST=`$OMSTAT -q test  2>/dev/null | wc -l`
UNIX=`$OMSTAT -q unix  2>/dev/null | wc -l`
#IDEL=`$OMSTAT -q idel  2>/dev/null | wc -l`
POISON=`$OMSTAT -q poison  2>/dev/null | wc -l`

#echo "archerr.value $ARCHERR"
echo "archive.value $ARCHIVE"
echo "bb.value $BB"
echo "dirsync.value $DIRSYNC"
#echo "dmm.value $DMM"
#echo "dump.value $DUMP"
#echo "errmgr.value $ERRMGR"
echo "error.value $ERROR"
#echo "license.value $LICENSE"
echo "local.value $LOCAL"
#echo "print.value $PRINT"
#echo "req.value $REQ"
#echo "resolve.value $RESOLVE"
echo "router.value $ROUTER"
echo "smerr.value $SMERR"
echo "smintfc.value $SMINTFC"
#echo "test.value $TEST"
echo "unix.value $UNIX"
#echo "idel.value $IDEL"
echo "poison.value $POISON"
