mute_time_intervals in Alertmanager

1,345 views
Skip to first unread message

Evelyn Pereira Souza

unread,
Sep 9, 2021, 8:37:15 AM9/9/21
to Prometheus Users
Hi

mute_time_intervals:
- name: Release
time_intervals:
- months: ["august"]
days_of_month: ["25", "26", "27"]
times:
- start_time: "20:00"
end_time: "23:00"
- months: ["september"]
days_of_month: ["25", "26", "27"]
times:
- start_time: "20:00"
end_time: "23:00"
- months: ["october"]
days_of_month: ["19", "20", "21"]
times:
- start_time: "20:00"
end_time: "23:00"
- months: ["november"]
days_of_month: ["15", "17", "22"]
times:
- start_time: "20:00"
end_time: "23:00"

How-To include here also the year?

The I wish to do a second block for ad hoc maintenance (not planned)

- name: AdHocMaintenanceWindows
time_intervals:
- months: ["august"]
days_of_month: ["04"]
times:
- start_time: "02:00"
end_time: "06:00"

I prefer for this block something more simple:

Just a date (example 09.09.2021) and and UTC start_time/end_time

How to do that?

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Brian Candler

unread,
Sep 9, 2021, 9:23:25 AM9/9/21
to Prometheus Users
For both planned and ad-hoc maintenance, you would be better off creating "Silences" in alertmanager, via its own web interface or via one of the alertmanager frontends like karma or alerta.io

This lets you set start and end times for the silence periods.  You can match on labels and label patterns, so you can silence some alerts without others.

As far as I understand, "mute_time_intervals" is intended for fixed regular patterns such as "don't alert this group between 6pm and 8am"

Brian Candler

unread,
Sep 9, 2021, 9:26:28 AM9/9/21
to Prometheus Users
But to answer your original question, you *can* match on year in mute_time_intervals if you really want, and the documentation shows how:

Evelyn Pereira Souza

unread,
Sep 9, 2021, 9:57:08 PM9/9/21
to Prometheus Users
On 09.09.21 15:23, Brian Candler wrote:
> For both planned and ad-hoc maintenance, you would be better off
> creating "Silences" in alertmanager, via its own web interface or via
> one of the alertmanager frontends like karma or alerta.io

Hi Brian

our team decided we wish to have this info in Git. We know "Silences"
and don't like it very much.

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Evelyn Pereira Souza

unread,
Sep 9, 2021, 9:59:12 PM9/9/21
to promethe...@googlegroups.com
On 09.09.21 15:26, Brian Candler wrote:
> But to answer your original question, you *can* match on year in
> mute_time_intervals if you really want, and the documentation shows how:
> https://prometheus.io/docs/alerting/latest/configuration/#time_interval

Hi Brian

please example YML. Thank you.

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Brian Candler

unread,
Sep 10, 2021, 3:36:27 AM9/10/21
to Prometheus Users
I already saw the YAML that you posted (with bad formatting, but I suspect that's a problem with google groups).

The link above describes the extra field that you need:

  years:
    [ - <year_range> ...]

and it also says:

year_range: A numerical list of years. Ranges are accepted. For example, ['2020:2022', '2030']. Inclusive on both ends.

What's unclear about that?  Or have you tried it, and found that it doesn't work?

I still think that Silences are really what you want.  If you want a history of silences in git, then you can write a tool which syncs your silences defined in git via the Alertmanager API.  Unfortunately the API is not properly documented but you could look at the source of alertmanager, or other clients which manage silences like karma.

Brian Candler

unread,
Sep 10, 2021, 3:50:45 AM9/10/21
to Prometheus Users

Evelyn Pereira Souza

unread,
Sep 10, 2021, 1:17:24 PM9/10/21
to promethe...@googlegroups.com
On 10.09.21 09:36, Brian Candler wrote:
> I already saw the YAML that you posted (with bad formatting, but I
> suspect that's a problem with google groups).

Hi Brian

yes Google bug:

https://www.mail-archive.com/promethe...@googlegroups.com/msg08744.html

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages