What your config says is:

- if the alert has label typeofalert="statuspal", send it to 
"x...@gmail.com" only (with the updated subject header)
- otherwise, send it to "a...@gmail.com" only

(Notice that "continue: true" doesn't make any difference on the final 
alerting rule.  If this rule matches, it would follow onto another rule if 
there were one, but it won't do the default action)

I don't see any problem, although I'd be inclined to simplify the template 
to

     subject: '{{ if eq .Status "firing" }}DOWN{{ else }}UP{{end}}'

Look at the stdout/stderr output from alertmanager (maybe "journalctl -eu 
alertmanager" if you're running it under systemd).  I think there's a debug 
mode tool

Trace the resolved E-mails - look at your E-mail logs, look at the logs on 
the receiver, check your spam folder etc.

You can also look at the counters which alertmanager itself creates (scrape 
localhost:9093/metrics to see them), to convince yourself that the resolved 
E-mails *are* being sent.

On Friday, 26 November 2021 at 11:31:37 UTC muktha...@gmail.com wrote:

> Hi Brian,
>
> Many thanks for your help. I am almost able to achieve whatever I wanted 
> to but with one receiver. When i add two receiver and try to send the 
> alerts. Based on the matcher alerts are fired and sent to the receiver but 
> resolved alerts are not going. Could you please verify my configs and let 
> me know if am on right track please. I am not able to get any error or any 
> insight from the alertmanger.log.
>
>  global:
>   resolve_timeout: 5m
>   smtp_smarthost: *******:25
>   smtp_auth_username: '*****'
>   smtp_auth_identity: '*****'
>   smtp_auth_password: '******'
>   smtp_from: '********'
>   smtp_require_tls: false
>
> route:
>   group_by: ['alertname']
>   group_wait: 10s
>   group_interval: 10s
>   repeat_interval: 5m
>   receiver: 'App-Kafka-Support'
>   routes:
>   - receiver: 'Statuspal'
>     matchers:
>     - typeofalert="statuspal"
>     continue: true
>
> receivers:
> - name: 'App-Kafka-Support'
>   email_configs:
>   - to: 'a...@gmail.com'
>     send_resolved: true
> - name: 'Statuspal'
>   email_configs:
>   - to: 'x...@gmail.com'
>     headers:
>       subject: '{{ if eq .Status "firing" }}DOWN{{ else if eq .Status 
> "resolved" }}UP{{end}}'
>     send_resolved: true
>
> Best Regards,
> Suman
>
> On Wednesday, November 24, 2021 at 3:46:59 PM UTC+5:30 Brian Candler wrote:
>
>> On Wednesday, 24 November 2021 at 09:21:54 UTC muktha...@gmail.com wrote:
>>
>>> I am assuming that if we have used send_resolved:true then once the 
>>> alert is resolved .Status value will be set to resolved and the subject 
>>> would be updated accordingly. 
>>>
>>> For me I am not able to see any errors in the log file. Alertmanager 
>>> service and prometheus are up and running fine. Alerts are activated in 
>>> Prometheus but emails have not trigerred so far.
>>
>>
>> Then it's up to you to either create an alert condition or resolve an 
>> alert condition, to force an alert to be sent out.  Or wait for the 
>> repeat_interval (24h) if there are already active alerts.
>>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/prometheus-users/e3e035c8-447b-4408-8cfd-816418dedcb5n%40googlegroups.com.

Reply via email to