Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
fail2ban
1.0
2020-03-22
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
- Nagios XI
GPL
5624
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
### Installation
This plugin requires fail2ban and sudo installed. Also several commands must be runnable by nagios user with sudo, so add the following to visudo:
# Needed for check_fail2ban
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client status
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client status *
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client get * banip
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client get * banip --with-time
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client get * bantime
### Usage
./check_fail2ban -h Display this message
-w defaults to 10
-c defaults to 20
-t Time: Display until when IPs will be banned
-j i.e. comma separated string of jails, i.e. ssh,postfix
Only check those jails
###Examples
./check_fail2ban -t -w 5 -c 10 -j ssh,postfix
./check_fail2ban -t
This plugin requires fail2ban and sudo installed. Also several commands must be runnable by nagios user with sudo, so add the following to visudo:
# Needed for check_fail2ban
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client status
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client status *
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client get * banip
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client get * banip --with-time
nagios ALL=NOPASSWD: /usr/bin/fail2ban-client get * bantime
### Usage
./check_fail2ban -h Display this message
-w
-c
-t Time: Display until when IPs will be banned
-j
Only check those jails
###Examples
./check_fail2ban -t -w 5 -c 10 -j ssh,postfix
./check_fail2ban -t
Reviews (2)
bymiked, June 25, 2024
Easy to follow instructions, works perfectly.
Exaclty what I needed
Exaclty what I needed
byjotta, July 31, 2020
H, thank you for this plugin,. It works great when I run it locally on the machine where Fail2Ban is running. But I cannot get it running remotely from the Nagios Server.
I tried to check it directly with adding "-H " to your command syntax as well as configure a remote NRPE call from Nagios Server to the server where Fail2Ban is running. But the result is still the same: "Error: fail2ban-client not found"
What do I do wrong? Thank you, Jakub
I tried to check it directly with adding "-H " to your command syntax as well as configure a remote NRPE call from Nagios Server to the server where Fail2Ban is running. But the result is still the same: "Error: fail2ban-client not found"
What do I do wrong? Thank you, Jakub
Owner's reply
Hi, sorry for the late response!
it is intended to run this command via NRPE from the nagios server. Are you sure that your nrpe command is defined properly? How does it look like?