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

Is it possible to only generate alerts in the working hours #1164

Closed
bbigras opened this Issue Oct 14, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@bbigras
Copy link

bbigras commented Oct 14, 2015

I have the following rule to get alerts if my program didn't do its job at least once in the last 15 minutes.

I would like to be only notified in the working hours (like 9:00AM to 5:00PM).

Limiting alerts depending of the current time may not make sense for online services but in my case, it's for a polling program that only run in the working hour and if a problem happens, it's important enough (in the day) that I get paged.

ALERT TestLastOk
  IF absent(last_ok ) or on (name) (time() - last_ok > 900)
  WITH {}
  SUMMARY "problem"
  DESCRIPTION "the thing didn't run in the last 15 minutes"
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 14, 2015

Presuming you're in UTC, (vector(time()) % 86400 / 3600 > 5 < 17) will return a timeseries in that time. and could be used to restrict based on that.

@bbigras

This comment has been minimized.

Copy link
Author

bbigras commented Oct 16, 2015

Thanks.

Is there also a way to restrict based on the weekday (like monday to friday)?

@barkerd427

This comment has been minimized.

Copy link

barkerd427 commented Oct 16, 2015

I've asked previously, and I think this is a matter for the AlertManager.
The new version is currently under construction. I'm hoping it will include
this functionality.
On Oct 16, 2015 14:09, "Bruno Bigras" notifications@github.com wrote:

Thanks.

Is there also a way to restrict based on the weekday (like monday to
friday)?


Reply to this email directly or view it on GitHub
#1164 (comment)
.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 16, 2015

@brunoqc not currently. You could have an exporter that reported the current day.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 27, 2015

This question was answered.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.