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

Timezone function #4227

Closed
allangood opened this Issue Jun 5, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@allangood
Copy link

allangood commented Jun 5, 2018

Proposal

A function to return the current timezone offset value (-3, -4, +6, so on) on the Prometheus server.

I'm trying to implement something similar as posted here: https://www.robustperception.io/combining-alert-conditions/

The main idea is to be notified about non critical (warning) alerts only during work hours. Same way many others monitoring/alert systems do (Nagios, Zabbix, etc).

Using the hours() function is the closest way to archive this feature, but the lack of the timezone offset information (and mainly the daylight savings information) make it very difficult, since I need to manually change the rule every time the daylight saving begins or it ends.

Using the same example of the blog, but with the "timezoneoffset()" value this problem can be solved:

groups:
- name: test.rules
  rules:
  - alert: LatencyTooHigh
    expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5 and ON() ( hour() + timezoneoffset() ) > 9 < 17

Bug Report

Accordingly to https://prometheus.io/docs/prometheus/latest/querying/functions/
There is no timezone offset information available.

What did you expect to see?
Timezone offset information

What did you see instead? Under which circumstances?
No timezone offset information

Environment
All

  • System information:

All

  • Prometheus version:

All

@allangood

This comment has been minimized.

Copy link
Author

allangood commented Jun 5, 2018

Seems to be duplicated #4160

@allangood allangood closed this Jun 5, 2018

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 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 22, 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.