Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
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.