I have a check program script that I want to run using monit every hour starting at 12pm PST/ 19 UTC.
The script is pretty basic. It gets the current time , and then execute a SQL query against a mysql db using the current date to check if a table has data in it (select count (*) from table where date = $today). If count = 0 it exits with code 0 else with exit code 1.
I have the following config
check program check_table
with path /opt/monit/scripts/check_table.sh
every "* 19 * * *"
if status != 0 then alert
What this is currently doing is, starting at 12 PM, it executes the script every 2 mins (my default polling interval ) till 1pm. If it fails at the first check it raises an alert, and for the subsequent checks it doesn't raise an alert. I'm guessing there is some throttling in place that prevents monit from alerting for the same issue more than once. But the problem is when next day comes and at 12pm it starts the check again and it fails, I don't get a new alert because there is already an active alert for this.
How can I solve this problem being able to get at most one alert every day for this check