mute_time_interval examples (for maintenance window)

659 views
Skip to first unread message

Evelyn Pereira Souza

unread,
Aug 19, 2021, 5:25:20 AM8/19/21
to Prometheus Users
Hi

I need some mute_time_interval examples.

Beginning of the year we define every month 3x maintenance window. The
dates different for every month. The time the same.

I wish that in those 3x maintenance window every month no alerts going out.

Can you provide me examples how-to implement that?

This docs not enough help for me
https://prometheus.io/docs/alerting/latest/configuration/#mute_time_interval

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Benjamin Ridley

unread,
Aug 19, 2021, 7:29:56 PM8/19/21
to Prometheus Users
Hi Evelyn,

I hope I'm understanding correctly, you could do something like this for defining the intervals for the year:

mute_time_intervals:
  - name: maintenance_windows
    time_intervals:
- months: ['january']
days_of_month: ['7', '18', '28']
times:
- start_time: '18:00'
end_time: '24:00'
- months: ['february']
days_of_month: ['5', '14', '26']
times:
- start_time: '18:00'
end_time: '24:00'
- months: ['march']
days_of_month: ['8', '19', '30']
times:
- start_time: '18:00'
end_time: '24:00'

... etc
​
Then inside whatever routes you are using, you just need to reference the interval:
route:
  group_by: ['...']
  group_wait: 1s
  group_interval: 1m
  repeat_interval: 3h
  routes:
    - matchers:
         - severity = critical
      mute_time_intervals:
        - maintenance_windows
​
I hope that helps!

Cheers,
Ben

Evelyn Pereira Souza

unread,
Aug 20, 2021, 2:19:17 AM8/20/21
to promethe...@googlegroups.com
On 20.08.21 01:29, Benjamin Ridley wrote:
> I hope that helps!

Thank you very much. Exactly what I am looking for. Only 1 small problem
I not know how-to solve:

start_time: '22:00'
end_time: '02:00' (next day)

have a great day

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Benjamin Ridley

unread,
Aug 22, 2021, 9:00:58 PM8/22/21
to Evelyn Pereira Souza, Prometheus Users
No worries Evelyn!

In that case, you can split the time interval into the days you want muted late at night, and then the days you want muted early in the morning. Like so:

mute_time_intervals:  
- name: maintenance_windows
time_intervals:
  - months: ['january']
    days_of_month: ['7', '18', '28']
    times:
      - start_time: '22:00'
        end_time: '24:00'
  - months: ['january']
    days_of_month: ['8', '19', '29']
    times:
      - start_time: 00:00,
        end_time: '02:00'


--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/H_jrownsgvo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e0454a3c-2444-1242-2f77-40d4cc37b9e5%40disroot.org.
Reply all
Reply to author
Forward
0 new messages