PMM 2.31.0 Failed to send test alert.: SMTP not configured, check your grafana.ini config file's [smtp] section

Hi Team,

After upgrading to 2.31.0, then we are unable send the mails and we are getting the below error.

Failed to send test alert.: SMTP not configured, check your grafana.ini config file’s [smtp] section

While I am testing the contact points I am getting the below error.

Can you please help on this error?

1 Like

Just to clarify, did sending emails work before you upgraded?

2 Likes

Yes @matthewb I am able to send the emails. Even I have ran the migration script and I am able to see all the previous alerts which I have configured earlier version.

1 Like

There was a pretty big change between the tech preview version and the GA version of Alerting, namely that we switched to Grafana’s native alert engine (where before PMM did the alerting though a dedicated alertmanager). So the configuration UI we created to set your SMTP server went away because we rely on Grafana’s engine to deliver now.

That means you need to configure your SMTP settings again by either 1) editing the /etc/grafana.ini inside the pmm container (not recommended*) or 2) set the appropriate variables when you create your docker container and here is a blog post on how to accomplish that via docker run but you can tailor it similarly for docker compose if that’s how you create your containers.

*the reason we don’t recommend editing the grafana.ini directly is that from time to time our upgrade process might replace it with a new version and if you replace your container you will definitely lose any changes.

1 Like

Hi @steve.hoffman

Thanks for you inputs. But if its a new server we would have use 2nd option but already running server, is it good to go with option 2?

1 Like

Hi @Naresh9999

Yes @steve.hoffman 's #2 option is to use the gmail relay as an example where 7 SMTP environment variables were set so that Grafana could properly route SMTP. This is the recommended approach to use :+1:

1 Like

Hi team,
this is my /etc/grafana/grafana.ini configuration file
image

1 Like

but i also got this errror ??? please help me out …

1 Like

I think you meant that because it’s an existing server can you use option 1…you can BUT i would recommend you keep a backup copy of the resulting grafana.ini because at some point it’s going to get overwritten (this most recent release we went from grafana 8 to 9 so almost certainly overwrote the .ini).

Even with an existing server, you can still use option 2 with the env vars IF you use a separate volume for the pmm data (if you followed the install instructions you should have a container for pmm-data). At which point you can simply re-run your docker run command from your command history and add the env vars.

example:
originally you may have run something like
docker run -d -p 8080:80 -p 8443:443 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:2

but you can stop and delete the pmm-server container and re-run as:
docker run -d -p 8080:80 -p 8443:443 --volumes-from pmm-data --name pmm-server --restart always -e GF_SMTP_ENABLED=true -e GF_SMTP_HOST=smtp.gmail.com:587 -e GF_SMTP_USER=email@domain.com -e GF_SMTP_PASSWORD=<password> -e GF_SMTP_SKIP_VERIFY=false -e GF_SMTP_FROM_ADDRESS=email@domain.com -e GF_SMTP_FROM_NAME=Grafana -e percona/pmm-server:2

2 Likes

when i try this data not loaded…

1 Like

Hi team, please help to solve me this issue…

1 Like

Hi Steve!
Which is the best solution to configure smtp for Grafana in a persistent way when PMM is installed using Podman (following this documentation: Podman - Percona Monitoring and Management), please?
Thanks and Best Regards,
Elisa

1 Like

@Dharmendra, hard to diagnose from that error…I’m going to guess it’s the square brackets you have around your host in your grafana.ini config from above. have you tried host:587=smtp.grafana.com?

you can run the test while you’re tailing the /srv/logs/grafana.log inside the pmm container (docker exec pmm-server tail -f /srv/logs/grafana.log) and that might give a better hint to what grafana doesn’t like about the ini file.

1 Like

hmmmm… @Denys_Kondratenko might be able to help (I’m no podman guru)…my guess is something like adding:

GF_SMTP_ENABLED=true
GF_SMTP_HOST=smtp.gmail.com:587
GF_SMTP_USER=email@domain.com
GF_SMTP_PASSWORD=<password>
GF_SMTP_SKIP_VERIFY=false
GF_SMTP_FROM_ADDRESS=email@domain.com
GF_SMTP_FROM_NAME=Grafana

to the ~/.config/pmm-server/pmm-server.env file.

2 Likes

Hi @elisetta1984,

yes, if you run service as described in a doc - Steve’s comment is exactly correct. pmm-server.env would be passed as env inside container --env-file=${PMM_ENV_FILE}.
So between restart and updates it would pass same envs to the container.

Thanks,
Denys

1 Like

Hi @Dharmendra

Hi team, please help to solve me this issue…
so in this case how did you set the settings?

when i try this data not loaded…
it doesn’t look like related to the settings. Could you please describe exact steps you are performing ?

Thanks,
Denys

1 Like