How to configure custom subject to send an emails

I want to expecting the email subject like below, can some one please help how can i get the custom email subject whenever any issue happen.

Actual Subject: [FIRING:1]

Expecting Subject: [CRITICAL]:[Environment] <Service_Name> down On <Host_Name/Server_Name>

EX1: [CRITICAL]:[DEV] MySQL down (C-DEV6-403) On tesDev101 server

EX2: [CRITICAL]:[QA] MySQL down (C-QA-403) On tesQA101 server

EX3: [CRITICAL]:[PROD] MySQL down (C-Prod-Db) On testProd201 server

Can we have example how can we get the email sub name like [CRITICAL]:[Environment] down <Service_Name> On ?

We don’t have any documentation for this in the PMM2 site.

1 Like

Can somebody help me on this?

1 Like

Can somebody help me on this?

1 Like

Can somebody help me on this?

1 Like

The ability to modify the email subject comes from upstream grafana and here’s the docs with the info you’re after starts. By using this PR as a guide, I was able to get some of the data using the test button for the contact point based on these template variables here

Any of:
{{ .Status }} {{ .CommonAnnotations }} {{ .GroupLabels }} worked using the test button but the moment I tried {{ .severity }} or {{ .Labels.severity }} or {{ $Labels.severity }} it would send the test but not render the subject in the email and I see the following in the /srv/logs/grafana.logs file:
level=warn msg="failed to template email message" err="template: :1:11: executing \"\" at <.labels.severity>: can't evaluate field labels in type *channels.ExtendedData"

which makes sense because it’s a test email not a real alert with labels added to it…my problem is that I broke something somewhere else in my setup so I can’t get a real email to generate to see if they would work on a legitimate firing alert but may be enough to get you pointed in the right direction.

1 Like

Hi @Steve_Hoffman

Thanks for the help. I tried the following options {{ .severity }} or {{ .Labels.severity }} or {{ $Labels.severity }} with genuine error, but still I am getting subject like empty or (no subject).

1 Like

Hi @Steve_Hoffman

Any luck from your end? or can you please request for any documentation or fix the issue?

1 Like

I asked on the grafana forums since this is technically a grafana feature but haven’t had any luck on my end getting it to work.

1 Like

Thanks for the update @Steve_Hoffman

Please update if found any solution or update from Grafana team.

As a user, he/she should customize Subject and Body.

1 Like