Firewall Software

check_fail2ban

Description:

checks the count of active jails
checks for banned IP’s
integrated performance data for banned IPs
shows banned IP since the last logrotate in long output

Modified:2013-03-12 (version 1.1)
-fix wrong count for output
-implement status check

Current Version

1.1

Last Release Date

2013-02-22

Compatible With

  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion

Owner

License

GPL


Project Files
Project Photos
Project Notes
Reviews (2) Add a Review
Not Sure How This Ever Worked
by OldBlogger, January 31, 2020

In the header block it mentions a staus check being implemented which I think is where this came from at line 18 ps_state=$(ps aux |grep "fail2ban.sock" |grep -v grep| wc -l) This seems to be an attempt to check if the fail2ban.sock socket has been created by the nagios-server, except this is looking at processes not sockets or at least it is on my Centos 7.7 installation, it always returns zero so the program aborts further down with the message ++++ Process is not running ++++ Change line 18 to this instead ps_state=$(ss -aux |grep "fail2ban.sock" |grep -v grep| wc -l) Basically use ss instead of ps and put the - before the aux options. Then it returns 1 as expected if the fail2ban-server is running and the script works correctly.



Update for new version of fail2ban
by svamberg, September 30, 2016

Output of 0.9.x fail2ban is different (added white characters). This patch fix it: --- a/check_fail2ban.sh +++ b/check_fail2ban.sh @@ -105,7 +105,7 @@ fi # ##################################################################### # Run the fail2ban-client, and generate the list of operating jails # ##################################################################### -jail_list=$($fail2ban_client status|grep "list" |cut -f 3 |tr -d ,) +jail_list=$($fail2ban_client status|grep "list" | cut -d : -f 2 | tr -d ,) # ##################################################################### # Cycle through all jails, count blocked IP, and build output strings



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
3.7 (3)
Favorites
0
Views
50,075