41 lines
927 B
Plaintext
41 lines
927 B
Plaintext
|
#!/bin/sh
|
||
|
#
|
||
|
# Wildcard-plugin to monitor bans on Fail2ban jails. To monitor an jail, link
|
||
|
# fail2ban_<jail> to this file. E.g.
|
||
|
|
||
|
# ln -s /usr/share/node/node/plugins-auto/fail2ban_
|
||
|
# /etc/munin/node.d/fail2ban_ssh-iptables
|
||
|
|
||
|
# Magic markers (optional - used by munin-config and some installation
|
||
|
# scripts):
|
||
|
|
||
|
#%# family=auto
|
||
|
#%# capabilities=autoconf
|
||
|
|
||
|
JAIL=${0##*/fail2ban_}
|
||
|
|
||
|
case $1 in
|
||
|
autoconf)
|
||
|
if [ -x $(which fail2ban-client) ]; then
|
||
|
echo yes
|
||
|
exit 0
|
||
|
else
|
||
|
echo no
|
||
|
exit 1
|
||
|
fi
|
||
|
;;
|
||
|
config)
|
||
|
echo "graph_title Fail2ban - $JAIL"
|
||
|
echo 'graph_vlabel active bans'
|
||
|
echo 'graph_category network'
|
||
|
echo 'graph_info This graph shows the amount of bans caught by Fail2ban'
|
||
|
echo "fail2ban.label $JAIL"
|
||
|
echo 'fail2ban.type GAUGE'
|
||
|
echo 'fail2ban.info The number of current bans.'
|
||
|
exit 0
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
echo -n "fail2ban.value "
|
||
|
$(which fail2ban-client) status $JAIL|awk '/Currently banned:/ { print $NF }'
|