Okay, this is the config file i have tried
receivers:
- name: send_email
email_configs:
- to: [email protected]
from: [email protected]
smarthost: smtp.zoho.com:587
auth_username: [email protected]
auth_password: pass
- name: send_email2
email_configs:
- to: [email protected]
from: [email protected]
smarthost: smtp.zoho.com:587
auth_username: [email protected]
auth_password: pass
route:
receiver: send_email
routes:
- receiver: send_email2
inhibit_rules:
- source_match:
severity: critical
target_match:
severity: warning
equal:
- alertname
- dev
- instance
On Thu, 10 Oct 2024 at 11:13, 'Brian Candler' via Prometheus Users <
[email protected]> wrote:
> Please show the configuration you have tried, to make it clearer what
> you're trying to do, and then we can help you correct it.
>
> email_configs takes a YAML list of email_config entries (see docs
> <https://prometheus.io/docs/alerting/latest/configuration/#receiver>), so
> a single receiver can have multiple E-mail destinations:
>
> receivers:
> - name: foobar
> email_configs:
> - to: [email protected]
> send_resolved: true
> - to: [email protected]
> send_resolved: true
>
> (and indeed it could include other types of transport; e.g. the same
> foobar receiver could also have a 'slack_config' section, a
> 'webhook_config' section, etc)
>
> The corresponding alerting rule is then very simple: e.g.
>
> routes:
> - matchers:
> - severity=critical
> receiver: foobar
>
> If you have some rules that want to send only to foo or only to bar, then
> you'd need to create additional named receivers, with just foo and just bar.
>
> **OR**
>
> You can create separate receivers, and then create routing rules which
> send to more than one receiver. For example, you could have these two
> separate receivers:
>
> receivers:
> - name: foo
> email_configs:
> - to: [email protected]
> send_resolved: true
> - name: bar
> email_configs:
> - to: [email protected]
> send_resolved: true
>
> However, the way you get a single alerting rule to send to multiple
> receivers is non-obvious. It requires a nested branch of the routing tree:
>
> routes:
> - matchers:
> - severity = "critical"
> routes: [ { receiver: foo, continue: true }, { receiver: bar } ]
>
> Note that the top-level route contains "routes" rather than "receiver".
> Within that list, the first route matches always (because it has no "match"
> or "matchers" condition) and sends to "foo", but "continue: true" makes it
> carry on to the second rule; that also always matches, and sends to "bar".
> Repeat as many times as necessary. All except the last need "continue:
> true" - and it doesn't harm to set it there as well.
>
> "receiver" is only used when no child routes match. Since all alerts
> passed to the child "routes" are matched and consumed, it never falls back
> to "receiver", meaning there's no need to set "receiver" as well on this
> rule.
>
> On Thursday 10 October 2024 at 09:54:51 UTC+1 Chinelo Ufondu wrote:
>
>> Hello everyone
>>
>> I am currently trying to configure two email receiver in my alertmanager
>> config file, of which i did but only one works fine, I wanted to ask if its
>> possible to have two email receivers, if so, please i need an example
>> template, because i have tried all i could get my hands on, but to no avail.
>>
> --
> 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/389dba7f-8dfe-4f94-b648-99071478a703n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/389dba7f-8dfe-4f94-b648-99071478a703n%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/CAL2E%2B81UBJhr3nPSWQ6r5XRUX1QMXBzx_vWzYBfLbFnOBF%3DLRg%40mail.gmail.com.