Created
March 11, 2019 16:39
-
-
Save droM4X/f65f6f0cb5d2f1dc8177a74600ded352 to your computer and use it in GitHub Desktop.
Collectd - fail2ban ban stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTNAME=${COLLECTD_HOSTNAME:-localhost}; | |
INTERVAL=${COLLECTD_INTERVAL:-60}; | |
while sleep "$INTERVAL" | |
do | |
for q in dovecot postfix roundcube-auth sasl ssh | |
do | |
count=$(sudo fail2ban-client status $q | grep 'Currently banned' | awk '{print $(NF)}') | |
echo "PUTVAL \"$HOSTNAME/exec-fail2ban/gauge-fail2ban_$q\" interval=$INTERVAL N:$count" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment