[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to configure monit to alert only once per day for a check progra

From: Leif Gustafson
Subject: Re: How to configure monit to alert only once per day for a check program
Date: Sun, 18 Oct 2015 12:00:25 -0800

This is an annoying problem with the "check program" test. I ended up writing a wrapper script that gets executed every cycle and implements its own crude form of scheduling to determine when to execute the real program. At other times it merely exits with an exit code of 0. This is also useful for long-running checks, because otherwise the result of the test is only evaluated on the next scheduled execution (which would often be too late to be useful).

On 10/15/2015 12:00 PM, Vikram Kone wrote:
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/
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

To unsubscribe:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]