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

Description:

I had installed PMM on by Ubuntu VPS by reading the docs and was trying to add SMTP Config by reading the docs here: Percona Alerting - Percona Monitoring and Management . I have created env file and have added the variables mentioned in the docs. Here is what my env file looks like:

GF_SMTP_ENABLED=true  
GF_SMTP_HOST=smtp.gmail.com:587
GF_SMTP_USER=myname@gmail.com
GF_SMTP_PASSWORD=gmail-app-password
GF_SMTP_SKIP_VERIFY=false
GF_SMTP_FROM_ADDRESS=myname@gmail.com
GF_SMTP_FROM_NAME=Percona Alerting

And when I start the container with the --env-file flag for the env ,I created the container starts as well.

When I go inside the container using:

$: sudo docker exec -it pmm-server /bin/sh

I’m inside of the running container for pmm-server and when I use the env command, I get the contents of my env file provided during docker container initialization, so all the contents of file like GF_SMTP_ENABLED, GF_SMTP_USER… etc (All contents of the env file that was provided are logged out in the console).

So, I’m assuming there is no problem for setting up the env and getting those values inside docker?

But as I try to send test email from the PMM dashboard, in the Alerts section, under Alerting > Contact point and when I try to send test email I get this error:

Version:

PMM agent version: 2.40.1

Hi Baniya,

Could run a pmm-server container with directly specified env variables?
e.g.

docker run -d -p 80:80 -p 443:443 --name pmm-server \
--restart always \
-e GF_SMTP_ENABLED=true \
-e GF_SMTP_HOST=smtp.gmail.com:587 \
-e GF_SMTP_USER=test@gmail.com \
-e GF_SMTP_PASSWORD=password \
-e GF_SMTP_SKIP_VERIFY=false \
-e GF_SMTP_FROM_ADDRESS=test@gmail.com \
-e GF_SMTP_FROM_NAME=Grafana \
percona/pmm-server:2
1 Like

Hey, thanks for your reply.

Running the docker container like the way you provided above does solve the problem and its now working.

I wonder why that may be happening?