Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monit - Allow cron-style negative schedules #4468

Open
3 tasks done
cookiemonsteruk opened this issue Jan 15, 2025 · 1 comment
Open
3 tasks done

Monit - Allow cron-style negative schedules #4468

cookiemonsteruk opened this issue Jan 15, 2025 · 1 comment

Comments

@cookiemonsteruk
Copy link

cookiemonsteruk commented Jan 15, 2025

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.
The monit plugin does not currently allow to use negative cron style schedules

Describe the solution you'd like
I would like to be able to enter a negative expression as per the monit official documentation https://mmonit.com/monit/documentation/monit.html#Service-checks

Example 3: Do not run the check in the backup window on Sunday between 0AM to 3AM, otherwise run the check with the regular poll cycle frequency.

check process mysqld with pidfile /var/run/mysqld.pid
not every "* 0-3 * * 0"

Describe alternatives you've considered
As a workaround I have been able to enter * 6-5 * * * where I wanted to enter not every "* 5-6 * * 0" because my goal is to run every minute, every hour, every day, except between hours of 5 and 6, every day, evere month, every day of the week.

Additional context
To reproduce go to create or edit a service in monit UI, enable advanced mode. In "poll time" enter not every * 5-6 * * * or 'not every' * 5-6 * * * or "not every" * 5-6 * * * and I tried a few other permutations and the form sometimes if I recall correctly, errors with validation input. Fair enough.
Sometimes for instance entering not every * 6-5 * * * ends with an entry in /usr/local/etc/monitrc of every "not every * 6-5 * * *" without form validation error but when you investigate you see an entry in the plugin log of:

<!--StartFragment-->
2025-01-15T16:00:43 | Error | monit | /usr/local/etc/monitrc:25: syntax error 'not every'
-- | -- | -- | --

I am contradicting the allowed entry above but I forgot a bit which ones. It matters not, as we can easily see that the form validation does not parse for "Should be a string between 1 and 255 characters. Allowed characters are letters and numbers as well as asterisk, hyphen, comma and space."
Edit: A validation error can be created entering not every "* 6-5 * * *" as an entry attempt.

In summary. I think the current validation unless I have been unable to find the correct way to enter it, does not allow a window to not run the check. Since the underlying code is able to accept it, I hope we can enable those entries.

@cookiemonsteruk
Copy link
Author

Addition. If we enter * 6-5 * * * to have an unmonitored window between 05:00 and 06:00 then the monit service starts but this "service setting" stays in status "Waiting" indefinitively.
I have been able to use the alternative workaround of * 6-24,0-5 * * *. Now it goes to "OK" instead of "Waiting".
It would still be very useful to be able to use negative as per monit's code and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant