Using two recievers for one alert

34 views
Skip to first unread message

Nenad Rakonjac

unread,
Nov 22, 2022, 11:37:12 AM11/22/22
to Prometheus Users
Hi everyone, 

Is it possible to use two receivers for one alert? I want to implement something like this:

- match:
type: alert_alert
receiver: receiverOne

- match:
type: alert_alert
receiver: receiverTwo

receivers:

- name:  receiverOne
  email_configs:
  - to: 'emai...@gmail.com'
    from: 'emai...@gmail.com'

- name:  receiverTwo
  email_configs:
  - to: 'email...@gmail.com'
    from: 'emai...@gmail.com'

Julien Pivotto

unread,
Nov 22, 2022, 11:46:07 AM11/22/22
to Nenad Rakonjac, Prometheus Users
you have two solutions:

1. use continue: true

- match:
type: alert_alert
receiver: receiverOne
continue: true
- match:
type: alert_alert
receiver: receiverTwo

2. combine the receivers

- name: receiverOne
email_configs:
- to: 'emai...@gmail.com'
from: 'emai...@gmail.com'
- to: 'email...@gmail.com'
from: 'emai...@gmail.com'

> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/08996072-a8c0-4ab8-b0fe-0bb89c88e7ben%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Brian Candler

unread,
Nov 22, 2022, 12:27:59 PM11/22/22
to Prometheus Users
Option 3: use child routes.  This avoids duplicating the match conditions.

- match:
    type: alert_alert
  routes: [ {receiver: receiverOne, continue: true}, {receiver: receiverTwo} ]  

The 'routes' branch is a separate subtree. Since each of the routes within it has no 'match' conditions, it implicitly matches everything, delivering to each of the receivers listed.  You need continue: true on each of them, except for the last.
Reply all
Reply to author
Forward
0 new messages