What version of alertmanager are you using? Your configuration is invalid, 
so I don't know how you're even getting alertmanager to start.

You have a top-level "routes:" block (before "inhibit_rules"), and you have 
another "routes:" block nested under inhibit_rules, but neither of 
these are allowed by Alertmanager. If I try to run your config with 
alertmanager-0.27.0 I get an explicit error:

ts=2025-01-02T16:41:05.905Z caller=coordinator.go:118 level=error 
component=configuration msg="Loading configuration file failed" 
file=amtest.conf err="yaml: unmarshal errors:\n*  line 12: field routes not 
found in type config.plain\n  line 23: field routes not found in type 
config.plain*"

It would be valid to nest "routes" under "route", like this:

route:
  group_wait: 1m
  group_interval: 5m
  repeat_interval: 12h
  group_by: ["alertname", "severity"]
  # Default receiver (for all alerts that don't match any specific route)
  receiver: "gmail"

  routes:
    - receiver: "gmail"
      continue: true
    - receiver: "dev-receiver"

Note the spacing: "routes:" is indented to line up with other attributes 
like "receiver", not at the top level. Furthermore, if you did, it could 
explain the behaviour you're seeing, since this configuration requests all 
messages to be sent to both receivers. But since you say that's *not* your 
actual configuration, I think we have to start somewhere else.

How are you getting your config into alertmanager? Are you editing the 
alertmanager configuration directly, or is it coming via some frontend like 
a helm chart which spits out the config? If so, can you show the generated 
config, which is the actual file that alertmanager consumes?

> What changes can I make so that each receiver gets it's own individual 
email notification instead of grouping them together?

What do you mean by "individual email notification instead of grouping them 
together"?  Do you want some alerts to go to one receiver, and some alerts 
to go to a different receiver? If so, how do you want to choose which 
alerts go where?

On Thursday, 2 January 2025 at 15:16:26 UTC Chrysale Tchako wrote:

> This is my current alertmanager.yml config, but all notifications sent out 
> get sent to all emails added in the "to" section of the email configs. What 
> changes can I make so that each receiver gets it's own individual email 
> notification instead of grouping them together? Note the "from" email is 
> the same for both receivers.
>
> global:
>   smtp_hello: '*******.net'
>
> route:
>   group_wait: 1m
>   group_interval: 5m
>   repeat_interval: 12h
>   group_by: ["alertname", "severity"]
>   # Default receiver (for all alerts that don't match any specific route)
>   receiver: "gmail"
>
> routes:
>   - receiver: "gmail"
>     continue: true
>   - receiver: "dev-receiver"
>
> inhibit_rules:
>   - source_matchers:
>       - severity="critical"
>     target_matchers:
>       - severity="warning"
>     equal: ['alertname', 'instance']
>     routes:
>       - receiver: "gmail"
>         continue: true
>       - receiver: "dev-receiver"
>
> receivers:
>   # Default receiver for other alerts
>   - name: "gmail"
>     email_configs:
>       - to: "email1.net, email2.net"
>         from: '*******.net'
>         smarthost: 'smtp-relay.gmail.com:587'
>         send_resolved: true
>
>   - name: "dev-receiver"
>     email_configs:
>       - to: 'email3.net'
>         from: '*******.net'
>         smarthost: 'smtp-relay.gmail.com:587'
>         send_resolved: true
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/prometheus-users/a798d967-4b0b-4bbb-a840-6dd5cf125d09n%40googlegroups.com.

Reply via email to