Limit the number of executed commands for content matches test

Issue #1045 new
Lutz Mader created an issue

Hello,
based on the check file Monit will send alerts all the time a message content test will match. This is not a problem in general (from my point of view). Unfortunately a defined exec command will be executed for every content match test also.

check file file with path "/var/log/file.log"
  if not exist then exec "/usr/bin/touch /var/log/file.log"
  if content = "string simple .*" then exec "/usr/local/etc/monit/scripts/alert.sh"
  if content = "string match .*" 2 times within 5 cycles then exec "/usr/local/etc/monit/scripts/alert.sh"

There is only a way to limit the first executed command or alert, but in opposite to the behavior of Monit, all the time a message match the given content a command will executed.
I can not find a way to limit the number of executed commands by Monit. The status is still "Content match", but the command executed again and again.
For tests Monit execute commands or send alerts after a status change otherwise or based on the "repeat every x cycle" option.

The "repeat every x cycles" option will accepted but the command will executed every time and the "x cycles" will not honored.

check file file with path "/var/log/file.log"
  if content = "string match .*" 2 times within 5 cycles then exec "/usr/local/etc/monit/scripts/alert.sh" repeat every 5 cycles

Sometimes it is a good idea to limit the number of executed command or alerts to the first match in a given number of cycles, I think, but there is no way to do this.
In a short form, a way to limit the number of executed commands or alerts for a content match test is useful and should be available with Monit.

A suggestion for an enhancement only,
thanks for any help or suggestion,
Lutz