Changing email template

Hello all,

When using emails if an alert occurs, I need to change URL of PMM inside the mail. I changed PMM url from PMM settings but it still continue to send localhost at notifications. How can I change this?

Hello @Cihan_Tunali,
You will have to go into the docker container and edit grafana.ini inside /srv/ to change the template. Be aware that if you upgrade PMM, you will lose these changes. Our dev teams are aware of this feature request and are working on a better solution.

Thank you @matthewb , I am using PMM via OVF template. So which state should i add/modify to achieve my goal?

You’ll have to find the grafana.ini config file, probably in /opt/ or in /etc/ and edit the template.

I found it but I could not find the value need to be change/add.

A google search showed me to edit ‘/usr/share/grafana/public/emails/alert_notification.html’
https://sbcode.net/grafana/email-alert-template/

Actually, you enlighten my way. I found the solution but not with your way.

  • edit grafana.ini file
    vim /etc/grafana/grafana.ini

  • add below line into [server] section
    root_url = https://urlofpmm.com

  • restart grafana
    supervisorctl restart grafana

Now this is “the” solution. Thanks!

Sorry, I’m late to the party…I think you can (and should) do the following:

Login to PMM as an admin
Click the Gear Icon in the lower left corner → click Setttings → click Advanced Settings
You should see the “Public Address”. You can set this to the URL you want alerts to be formed with which will not only work for alerts but this also becomes needed for other services (DBaaS monitoring comes to mind) to be able to pre-determine your PMM url for pushing metrics back.

The only concern with changing the /etc/grafana/grafana.ini is that it’s possible it will get overwritten in certain upgrade scenarios.

Hi @steve.hoffman
Yeap, first I tried to change the value from Advanced settings but it did not change anything, I don’t know maybe you already aware about it.

I got information about changing the grafana.ini file will be replace if I update PMM. Thank you again.

hmmm…I will try again and open a ticket!

to combat the file being overwritten in a future upgrade… you can pass the following env variable if/when you do a container upgrade:
-e GF_SERVER_ROOT_URL=my.domain.com