#!/bin/bash
#
# Plugin to monitor the number of hosts denied by DenyHosts
#
# $Log$
# Revision 1.0  2009/06/05 16:00:00 tjansson
# Initial revision
#
# Parameters:
#
#       config   (required)
#       autoconf (optional - used by munin-config)
#
# Magick markers (optional):
#%# family=auto
#%# capabilities=autoconf

LOG=/etc/hosts.deny
if [ "$1" = "autoconf" ]; then
        if [ -r "$LOG" ]; then
                echo yes
        else
                echo no
        fi
        exit 0
fi

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

        echo 'graph_title Hosts denied by DenyHosts'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel denied hosts '
        echo 'graph_category network'
        echo 'HostsDenied.label Hosts denied by DenyHosts'
        exit 0
fi

echo HostsDenied.value  `egrep -c "DenyHosts" $LOG`
