Hi,

I think 
https://www.prometheus.io/docs/alerting/latest/configuration/#example 
should help.
If you don't want to receive emails to the 2 email addresses at the same 
time, you have to define 2 different receivers:

receivers:
- name: email-it
  email_configs:
  - to: [email protected] <https://groups.google.com/> 
    from: [email protected] <https://groups.google.com/>
- name: email-de
  email_configs:
  - to: [email protected] <https://groups.google.com/> 
    from: [email protected] <https://groups.google.com/>

And then, in section "route:" > "routes:", you will have some blocks 
including "match_re:" to route alerts matching some labels to the 
appropriate receiver, so something like:
- match_re:
  instance: A1
  receiver: email-it
- match_re:
  instance: A2
  receiver: email-de


Le jeudi 20 mai 2021 à 05:04:42 UTC+2, Ade a écrit :

> Hello,
>
> I have configured my *prometheus.yml* and *alertmanager.yml* file to look 
> like below but I need help with making alert manager send email alerts to 
> different users per instance(i.e email alerts for instance A1 goes to only 
> [email protected] and  instance B2 goes only to [email protected]). I currently 
> have all email alert sent to  [email protected] and  [email protected] at the 
> same time which seem too noisy at times.
>
> *  prometheus.yml   *
>
> global:
>   scrape_interval:     15s 
>   evaluation_interval: 15s 
>
> # Alertmanager configuration
> alerting:
>   alertmanagers:
>   - static_configs:
>     - targets:
>       # - alertmanager:9093
>         - localhost:9093
>
> # Load rules once and periodically evaluate them according to the global 
> 'evaluation_interval'.
> rule_files:
>   # - "first_rules.yml"
>   # - "second_rules.yml"
>     - "alert_rules.yml"
> # A scrape configuration containing exactly one endpoint to scrape:
> # Here it's Prometheus itself.
> scrape_configs:
>   # The job name is added as a label `job=<job_name>` to any timeseries 
> scraped from this config.
>   - job_name: 'prometheus'
>
>     # metrics_path defaults to '/metrics'
>     # scheme defaults to 'http'.
>
>     static_configs:
>     - targets: ['A1:9182','B2:9182'']
>     
>   - job_name: "ssl"
>     metrics_path: /probe
>     static_configs:
>       - targets:
>           - A1:1667
>           - B2:1667
>
>
> *alertmanager.yml*
> route:
>   group_by: [Alertname]
>   receiver: email
>   group_wait: 10s
>   group_interval: 5m
>   repeat_interval: 10m
>
> receivers:
> - name: email
>   email_configs:
>   - to: [email protected], [email protected] 
>     from: [email protected] 
>
> Any suggestion would be highly appreciated.
>
> Regards,
>
>
>

-- 
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/d8a49f30-88e8-4766-8412-a9fa49080fd1n%40googlegroups.com.

Reply via email to