From 6a931418055b40e5864e22401f8a242a56b7c6c8 Mon Sep 17 00:00:00 2001 From: "D. Becker" Date: Thu, 4 Feb 2010 14:28:28 +0100 Subject: [PATCH] Initial version --- plugins/other/blockhosts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 plugins/other/blockhosts diff --git a/plugins/other/blockhosts b/plugins/other/blockhosts new file mode 100755 index 00000000..c4f9a161 --- /dev/null +++ b/plugins/other/blockhosts @@ -0,0 +1,39 @@ +#!/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 + exit 0 + else + echo no + exit 1 + fi +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 system' + 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`