contrib-munin/plugins/horde/horde

68 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
#
# Script to show number of logins, errors and failed logins in horde3
#
#
# by Patrick Z.
# Comments and improvements can be sent to (admin<AT>tournament'dot'DE)
#
# possible problems:
# - horde3.log isn't readable by user munin (see
# /var/log/munin/munin-node.log for errors)
#
# -to solve, copy this in /etc/munin/plugin-conf.d/munin-node
# [horde3]
# user root
#
#
# formely known as postfix_mail_stats by:
# Boudewijn Ector, for Boudewijn Ector IT.
# Loosely based on http://munin.projects.linpro.no/attachment/wiki/PluginCat/postfix_messages_hourly.txt
#
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
LOGFILE=/var/log/horde/horde3.log
DATE=`date '+%b %d %H'`
MAXLABEL=20
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title horde3'
echo 'graph_category appserver'
echo 'graph_info This graph shows Horde3 logins, logouts and errors.'
echo 'graph_vlabel per hour'
echo 'logins.label logins'
echo 'failedlogins.label failed logins'
echo 'allerrors.label errors'
echo 'logouts.label logouts'
exit 0
fi
echo -en "logins.value "
echo $(grep "Login success for" $LOGFILE | grep "$DATE" | wc -l)
echo -n
echo -en "failedlogins.value "
echo $(grep "FAILED LOGIN" $LOGFILE | grep "$DATE" | wc -l)
echo -en "allerrors.value "
echo $(grep "error" $LOGFILE | grep "$DATE" | wc -l)
echo -en "logouts.value "
echo $(grep "Logout for" $LOGFILE | grep "$DATE" | wc -l)