contrib-munin/plugins/system/blockhosts

39 lines
896 B
Bash
Executable File

#!/bin/sh
# Plugin to monitor the number of hosts denied by BlockHosts
#
# $Log$
# based on:
# denyhosts plugin
# Revision 1.0 2009/06/05 16:00:00 tjansson
#
# Modified by d.becker 2010/02/04
#
# Parameters:
# config (required)
# autoconf (optional - used by munin-config)
LOG=/etc/hosts.allow
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 BlockHosts'
echo 'graph_args -l 0'
echo 'graph_vlabel denied hosts '
echo 'graph_category security'
echo 'HostsDenied.label Hosts denied by BlockHosts'
echo 'HostsWatched.label Hosts watched by BlockHosts'
exit 0
fi
echo HostsDenied.value `egrep -c " : deny" $LOG`
echo HostsWatched.value `egrep -c "#bh: ip:" $LOG`