configurationnotificationsprometheusprometheus-alertmanager

How can I configure and use a time_interval from eg Friday 20:00 to Monday 07:00?


I want to disable certain Prometheus alerts between Friday and Monday. We already configured our reciever and routes like the following:

routes:
- receiver: 'msteams'
  matchers:
    - alertname =~ "Example-.+"
  mute_time_intervals:
    - weekend

Now I'm stuck at defining the time interval weekend

We made sure that the alert itself works as expected.

I tried refering to the documentiation here but I would like to see a full example with a time_intervalsection which I can refer to.


Solution

  • You can define a weekend time interval as:

    time_intervals:
      - name: my_weekends
        time_intervals:
          - weekdays: ['friday']
            times:
              - start_time: 20:00
                end_time: 24:00
          - weekdays: ['saturday:sunday']
          - weekdays: ['moonday']
            times:
              - start_time: 0:00
                end_time: 7:00