[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-26 Thread Brian Candler
On Friday, 26 November 2021 at 16:04:37 UTC muktha...@gmail.com wrote: > What should be added or changed if i want to send the alerts that matches > this labels typeofalert="statuspal" to a...@gmail.com as well along with > z...@gmail.com. > The simplest way is to make a new receiver with

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-26 Thread Brian Candler
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

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-26 Thread Sri man
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

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-24 Thread Brian Candler
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

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-24 Thread Sri man
Hi Brian, 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

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-24 Thread Brian Candler
I also tested your "headers: subject: ..." section under "email_configs". This is what Thunderbird showed me for a "resolved" E-mail: [image: resolved.png] Therefore, it all works as expected as far as I can see. Did you remember to signal to alertmanager that you'd changed its config? (Send

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-24 Thread Brian Candler
For completeness, this is the version of alertmanager I tested with: root@prometheus:~# /opt/alertmanager/alertmanager --version alertmanager, version 0.23.0 (branch: HEAD, revision: 61046b17771a57cfd4c4a51be370ab930a4d7d54) build user: root@e21a959be8d2 build date:

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-24 Thread Brian Candler
Once I had fixed the smtp_smarthost line to include quotes and a port number, the config you gave validates just fine for me. So if you have a problem with this config, you need to describe what the symptoms are (since the symptoms you gave previously no longer apply). I'm afraid I can't

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-24 Thread Sri man
Hi Brian, I am a beginner and have minimal knowledge about alertmanager. Could you please provide me some guidance please. I tried to add the subject in alertmanager.yml as below. But still no luck. global: resolve_timeout: 5m smtp_smarthost: * smtp_auth_username: '*'

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-23 Thread Sri man
Hello Brian, I have edited the default template as below. {{ define "__subject" }}[{{ if eq .Status "firing" }} "DOWN" {{ else }} "UP" {{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-19 Thread Brian Candler
To replace any header with a new template, follow the documentation of email_config here . # Further headers email header key/value pairs. Overrides any headers # previously set by the notification implementation. [

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-18 Thread Sri man
Hi Brian, Thanks for you inputs. Could you please help me where to add in and what to modify in the below line of code to get the email subject with the keyword "DOWN" for firing alerts and "UP" for resolved alerts. {{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing"

[prometheus-users] Re: Hot to set the email subject line based on the condition in alertmanager

2021-11-18 Thread Brian Candler
This is already done for you. With the default templates, the subject line has a prefix like [FIRING:2] or [RESOLVED]. However if your alerts are being grouped, and let's say one alert resolves, then you might then get an E-mail with subject [FIRING:1] which shows one alert still firing and