Grafana notifications in specific hours

In some times you want to receive notifications from grafana only in working hours. You may configure quiet hours, but in this case grafana show status as unhealthy, just not notifying you.

It’s possible to set hours, when alerts actually present and should be sent.

Just add new prometheus condition with code (time in UTC):

((hour() >= 9) * (hour() <= 18)) OR on() vector(0)

This expression returns 81 at 9:00-9:59, 100 at 10:00-10:59 etc between 9:00 and 18:00 (6 p.m.).

And add condition for this expression >0

First condition – original value expression, second – time interval.

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.