I've been working on a solution to ban web crawlers from the constant port sniffing to my self hosted web services. So I started using Fail2ban, which is a great tool for these specific scenarios.
At first, I set up an instant email notification, but after a day I got way too much emails to handle - kept receiving about 5 to 10 emails per hour!! (Damn you hackers!! 😄 ).
So I thought it would be interesting to have a summary report of the bans/unbans during the last hour instead. Basically, Fail2ban writes the new ban/unban action to a file, which is later on read by a script which emails the results and deletes the file.
These are the lines I used for the ban/unban actions.