ALert only during working hours

Hi,

I’ve been asked if it possible to configure alerting to trigger at the required interval ONLY during the working day - say from 8am to 6pm.

I don’t see any obvious way of doing it. Is it possible to do, or is this going to need to be a feature request?

Regards
Paul

Hi @surreynorthern,

Currently it’s not possible in a straightforward/user friendly way. If you could make a GitHub issue for us that would be great!

Temporarily I think it might be possible if you desperately need this now. I believe we have periodStart/periodEnd on the context variable passed to the painless script which is the time interval that the monitor should be running at. You could do a comparison against this to ensure it only runs at your desired times. Again, not a great solution, but something that can unblock you. Ideally we will add a feature that lets you disable it during certain timeframes.

Thanks,
Drew

Hi Paul,

I don’t know wich Open Distro release you are using, but in with the 0.7 version you can configure your monitor time interval with the crontab syntax. This should work for your case.

Best regards,

This might be a bit off topic, but I would use PagerDuty for this kind of settings.
You can send alerts from Elasticsearch to Pagerduty, then configure Pagerduty notifications accordingly (Configuration → Services → Settings → How should responders be notified? → Use defined support hours to determine how responders are notified).
It will allow you to use other useful features, like maintenance windows.

1 Like

If the alert runs at every minute, you can run it with a cron expression
* 8-18 * * 1-5
At every minute past every hour from 8 through 18 on every day-of-week from Monday through Friday.


If runs every hour
0 8-18 * * 1-5
At minute 0 past every hour from 8 through 18 on every day-of-week from Monday through Friday.

image

Hi @surreynorthern, forward alert to a pager and manage alert’s scheduling through this :wink: