2010-02-04 14:28:28 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# Plugin to monitor the number of hosts denied by BlockHosts
|
|
|
|
#
|
|
|
|
# $Log$
|
2018-08-02 02:03:42 +02:00
|
|
|
# based on:
|
2010-02-04 14:28:28 +01:00
|
|
|
# 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)
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2010-02-04 14:28:28 +01:00
|
|
|
LOG=/etc/hosts.allow
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
if [ -r "$LOG" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo no
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2010-02-04 14:28:28 +01:00
|
|
|
if [ "$1" = "config" ]; then
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2010-02-04 14:28:28 +01:00
|
|
|
echo 'graph_title Hosts denied by BlockHosts'
|
|
|
|
echo 'graph_args -l 0'
|
|
|
|
echo 'graph_vlabel denied hosts '
|
2017-02-24 05:01:30 +01:00
|
|
|
echo 'graph_category security'
|
2010-02-04 14:28:28 +01:00
|
|
|
echo 'HostsDenied.label Hosts denied by BlockHosts'
|
|
|
|
echo 'HostsWatched.label Hosts watched by BlockHosts'
|
|
|
|
exit 0
|
|
|
|
fi
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2010-02-04 14:28:28 +01:00
|
|
|
echo HostsDenied.value `egrep -c " : deny" $LOG`
|
|
|
|
echo HostsWatched.value `egrep -c "#bh: ip:" $LOG`
|