#!/bin/sh # # Plugin to monitor squirrelmail logins # # Parameters: # # config # autoconf # # #%# family=contrib #%# capabilities=autoconf if [ "$1" = "autoconf" ]; then #if [ -f $CACHEFILE ]; then echo yes exit 0 #else # echo "no (could not find cache file)" #fi #exit 1 fi LOGFILE=${logfile:-/var/log/messages} OFFSET_FILE=/var/lib/munin/plugin-state/squirrelmail_login.offset LOGTAIL=${logtail:-/usr/sbin/logtail} if [ "$1" = "config" ]; then echo 'graph_title Squirrelmail logins' echo 'graph_vlabel quantity' echo 'graph_category Mail' echo 'connection.label successful' echo 'failedlogin.label failedlogin' exit 0 fi TEMP_FILE=`mktemp -t munin-squirrelmaillogin.XXXXXX` if [ -z "$TEMP_FILE" -o ! -f "$TEMP_FILE" ]; then exit 3 fi ${LOGTAIL} -f ${LOGFILE} -o ${OFFSET_FILE} > ${TEMP_FILE} connection=`grep Successful ${TEMP_FILE} | wc -l` failedlogin=`grep Failed ${TEMP_FILE} | wc -l` rm ${TEMP_FILE} echo "connection.value ${connection}" echo "failedlogin.value ${failedlogin}"