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?
Just to clarify, did sending emails work before you upgraded?
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.
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.
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?
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
this is my /etc/grafana/grafana.ini configuration file
but i also got this errror ??? please help me out …
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.
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_USERfirstname.lastname@example.org -e GF_SMTP_PASSWORD=<password> -e GF_SMTP_SKIP_VERIFY=false -e GF_SMTP_FROM_ADDRESSemail@example.com -e GF_SMTP_FROM_NAME=Grafana -e percona/pmm-server:2
when i try this data not loaded…
Hi team, please help to solve me this issue…
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,
@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.
hmmmm… @Denys_Kondratenko might be able to help (I’m no podman guru)…my guess is something like adding:
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
So between restart and updates it would pass same envs to the container.