Guest User

fail2ban_

a guest
Jul 14th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.98 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Wildcard-plugin to monitor bans on Fail2ban jails. To monitor an jail, link
  4. # fail2ban_<jail> to this file. E.g.
  5.  
  6. #    ln -s /usr/share/node/node/plugins-auto/fail2ban_
  7. #    /etc/munin/node.d/fail2ban_ssh-iptables
  8.  
  9. # Magic markers (optional - used by munin-config and some installation
  10. # scripts):
  11.  
  12. #%# family=auto
  13. #%# capabilities=autoconf
  14.  
  15. JAIL=${0##*/fail2ban_}
  16.  
  17. case $1 in
  18.   autoconf)
  19.     if [ -x $(which fail2ban-client) ]; then
  20.       echo yes
  21.       exit 0
  22.     else
  23.       echo no
  24.       exit 1
  25.     fi
  26.     ;;
  27.   config)
  28.     echo "graph_title Fail2ban - $JAIL"
  29.     echo 'graph_vlabel active bans'
  30.     echo 'graph_category network'
  31.     echo 'graph_info This graph shows the amount of bans caught by Fail2ban'
  32.     echo "fail2ban.label $JAIL"
  33.     echo 'fail2ban.type GAUGE'
  34.     echo 'fail2ban.info The number of current bans.'
  35.     exit 0
  36.     ;;
  37. esac
  38.  
  39. echo -n "fail2ban.value "
  40. $(which fail2ban-client) status $JAIL|awk '/Currently banned:/ { print $NF }'
Advertisement
Add Comment
Please, Sign In to add comment