Alerting ignore a specific time period

Is it possible to tell Watcher to either not run or suppress actions during a specific time period daily? For example, I want to run the watch every 30 minutes, but don't execute the action from 6PM - 7PM daily?


I am sure you could use a fancy cron expression for that (I would have to look those up as well, not a cron wizard, sorry). Alternatively, if the input is not too resource intensive, you could check the ctx.trigger.scheduled time in the condition and just return false to not trigger any action.

Hope that helps!


I didn't even consider cron, I was focusing on the trigger interval built into the watch itself. I'll look into that, thanks!

If cron doesn't work for your use-case, I did something similar in this webinar [1]: during business hours, look at running processes, and send a slack message if steam_osx is running.

On that page is a link to a gist with the watches I used [2], and I used a script condition to check the hour of the day[3]. The script condition there used Groovy (in ES 2.x) , so you'll need to update it to use Painless if you're using 5.0+, but the idea is the same.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.