prometheussreprometheus-alertmanagerobservability

Alertmanager: how to send alerts only in weekdays?


I tried to add this to my alertmanager.yml in root level, but I got this error: yaml: unmarshall errors: field time_intervals not found in type config.plain

time_intervals:
  - times:
    weekdays: ['monday:friday']

(I used 0.23 version of Alertmanager)


Solution

  • The correct syntax is the following:

    time_intervals:
      - name: monday-to-friday
        time_intervals:
          - weekdays: ['monday:friday']
    

    You can use this time interval like shown in the following example:

    route:
      group_by: ...
      ...
      routes:
        - receiver: SOME-RECEIVER
          matchers:
            - SOME-MATCHER
          active_time_intervals:
            - monday-to-friday
        ...