Ah right: at the very top level you must specify a catch-all receiver (in 
case no route matches). At lower levels in the tree you don't need to.

So just include one:

route:
  receiver: send_mail    # just to keep alertmanager happy, this will never 
be used
  routes:
    - receiver: send_email
      continue: true
    - receiver: send_email2

> is it possible to have just one send_email reciever configured for two 
email addresses?

Yes, as I showed in my first response 
<https://groups.google.com/g/prometheus-users/c/i0TwbBrlp7o/m/4X6bJsSNAAAJ>.

receivers:
- name: send_email
  email_configs:
  - to: [email protected] <https://groups.google.com/>
    send_resolved: true
  - to: [email protected] <https://groups.google.com/>
    send_resolved: true

On Friday 11 October 2024 at 14:54:01 UTC+1 Chinelo Ufondu wrote:

> Thank you for your email, I had omitted the receiver and tried this below 
> and it came up with an error message that i must specify a default receiver 
> route:
>   routes: [ { receiver: send_email, continue: true}, { receiver: 
> send_email2 } ]
> Plus in your last statement, is it possible to have just one send_email 
> reciever configured for two email addresses?
>
> On Thu, 10 Oct 2024 at 13:32, 'Brian Candler' via Prometheus Users <
> [email protected]> wrote:
>
>> route:
>>   receiver: send_email
>>   routes:
>>     - receiver: send_email2
>>
>> That route will only ever send to send_mail2. Why?
>>
>> "routes" are child routes of this route. When processing a given routing 
>> rule, alertmanager scans through all the child routes in turn, and the 
>> first one which matches is used. Only if *none* of them match, does it fall 
>> back to using the "receiver" at the top level of the routing rule.
>>
>> In your case, there is one child rule, and it always matches (because it 
>> has no conditions). It sends the mail to send_email2, and then terminates. 
>> Nothing more happens, and the fallback "receiver" is never used.
>>
>> If you want to send to both, then you would have two child routes:
>>
>> route:
>>   receiver: dontcare    # you can omit this line entirely (it's never 
>> used)
>>   routes:
>>     - receiver: send_email
>>       continue: true
>>     - receiver: send_email2
>>
>> "continue: true" is required so that after matching the first route, it 
>> continues to the next one instead of giving up immediately.
>>
>> You can write this in a more compact one-line form where [ ... ] is a 
>> list and { ... } is an object:
>>
>> route:
>>   routes: [ { receiver: send_email, continue: true}, { receiver: 
>> send_email2 } ]
>>
>> ...and that's what I showed before.
>>
>> But if all your alerts need to go to both E-mail addresses, it would be 
>> simpler to have a single "send_email" receiver with two E-mail addresses.
>>
>> -- 
>>
> 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 [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/59def785-af04-48a6-8c0f-4a1f394eae29n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/59def785-af04-48a6-8c0f-4a1f394eae29n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/6121c301-ee47-45b4-9424-f1fcd67e2160n%40googlegroups.com.

Reply via email to