Detect and prevent against attacks

I want to know how we can protect against “attacks” on our Piwik environment? I there a way to detect when somebody is attacking Piwik? Lets say if we get more then 25 hits from the same IP-address, is it possible to block that automatically?

It’s a web/php application security scenario and you can use something like mod_security (wikipedia[/url] to monitor and filter out attacks, and [url=https://en.wikipedia.org/wiki/Fail2ban]fail2ban (wikipedia) to firewall attackers.