# Trouble with smtp contact point in pmm 2.42.0

**URL:** https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659
**Category:** PMM 2.x
**Created:** [August 28, 2024, 8:42pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659 "2024-08-28T20:42:25Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Lobo\_Lobo20919](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lobo_lobo20919/32/14572_2.png) [@Lobo\_Lobo20919](https://forums.percona.com/u/Lobo_Lobo20919)
#### Post date: [August 28, 2024, 8:42pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/1 "2024-08-28T20:42:25Z")

</div>

I’m trying to setup just a basic test of pmm using the provided docker directions. I see that alert contact points has a grafana-default-email which is not configured. I have tried the example commands to start pmm:

docker run -d   
–publish 443:443   
-v /apps/pmm:/srv   
-e GF\_SMTP\_ENABLED=true   
-e GF\_SMTP\_HOST=mailrelay:25   
-e GF\_SMTP\_SKIP\_VERIFY=true   
-e [GF\_SMTP\_FROM\_ADDRESS=noreply@test.com](mailto:GF_SMTP_FROM_ADDRESS=noreply@test.com)   
-e GF\_SMTP\_FROM\_NAME=Grafana   
–name pmm-server   
percona/pmm-server:2.42.0

Which does not seem to configure email, in the /etc/grafana/grafana.ini there is no smtp section and modifying /usr/share/grafana/conf/defaults.ini does not work either it’s just over written.

The examples found on this site for doing the config of email via the website does not work either as the communications section is missing under settings.

Looking for some assistance in how to properly setup smtp.

Thanks.

---

<div class="post-metadata">

### Author: ![lalit.choudhary](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lalit.choudhary/32/51_2.png) [@lalit.choudhary](https://forums.percona.com/u/lalit.choudhary)
#### Post date: [August 29, 2024, 7:46am UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/2 "2024-08-29T07:46:53Z")

</div>

Hello @Lobo_Lobo20919

Have you tried createing .env file as described here ?  
[About Percona Alerting - Percona Monitoring and Management](https://docs.percona.com/percona-monitoring-and-management/get-started/alerting.html?h=smtp#configure-email-smtp-server-settings)

Please follow all steps, including the " Configure an Email contact point" steps, and try sending test email. If it fails, share the error with us.

---

<div class="post-metadata">

### Author: ![Lobo\_Lobo20919](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lobo_lobo20919/32/14572_2.png) [@Lobo\_Lobo20919](https://forums.percona.com/u/Lobo_Lobo20919)
#### Post date: [August 29, 2024, 1:54pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/3 "2024-08-29T13:54:23Z")

</div>

Here is my .env:

DISABLE\_UPDATES=true  
DATA\_RETENTION=336h  
ENABLE\_DBAAS=false  
PMM\_PUBLIC\_ADDRESS=10.x.x.x  
GF\_SMTP\_ENABLED=true  
GF\_SMTP\_HOST=mailrelay:25  
GF\_SMTP\_USER=  
GF\_SMTP\_PASSWORD=  
GF\_SMTP\_SKIP\_VERIFY=true  
[GF\_SMTP\_FROM\_ADDRESS=pmm-noreply@xx.com](mailto:GF_SMTP_FROM_ADDRESS=pmm-noreply@xx.com)  
GF\_SMTP\_FROM\_NAME=Percona Alerting

Our internal relay does not use authentication so I have tried blank fields and just removing GF\_SMTP\_USER and GF\_SMTP\_PASSWORD.

Started percona pmm with:

docker run --env-file=.env -p 443:443 -p 80:80 percona/pmm-server:2

The contact point grafana-default-email was updated to have a valid email address in Addresses, all other fields were left as is.

The error from a test message is

 ![Screenshot 2024-08-29 at 7.44.59 AM](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/3X/b/9/b96d62b6e7bf89355055cb07f84937156f2edd30.png)

Thanks for your assistance

---

<div class="post-metadata">

### Author: ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)
#### Post date: [August 29, 2024, 2:24pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/4 "2024-08-29T14:24:14Z")

</div>

When you open a shell inside the container and run `env | grep "GF_"` do you see all your values?

I have mine configured exactly like yours and it works just fine. There should be errors in /srv/logs/grafana.log if the SMTP server is rejecting the email. the screenshot feels like a generic error from grafana vs not actually setup. With gmail I had to make sure that the from address and user matched or gmail would silently blackhole the message so as not to give away info on what emails do/don’t exist…maybe your SMTP server does the same?

You can do an SMTP test via telnet pretty easy to make sure the server will accpt mail from your host…worked at many orgs that didn’t allow unauthenticated relaying or restricted sending IP’s so that workstations couldn’t become spam zombies. Just do a `yum install telnet` inside the PMM container. It looks something like:

```auto
telnet smtp.server 25
helo test
mail from: user@domain.com
rcpt to: recipient@domain.com
data
subject: test
this is a test message

```

(note there’s a double enter after the message to trigger the actual send)

---

<div class="post-metadata">

### Author: ![Lobo\_Lobo20919](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lobo_lobo20919/32/14572_2.png) [@Lobo\_Lobo20919](https://forums.percona.com/u/Lobo_Lobo20919)
#### Post date: [August 29, 2024, 3:32pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/5 "2024-08-29T15:32:26Z")

</div>

FYI to share the details I have to change any internal host name and IP to something that is not valid, so the mailrealy etc is mocked up for this post, the real values do work.

I do see the GF values in the pmm container

docker ps  
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
29d03a8dfe81 percona/pmm-server:2 “/opt/entrypoint.sh” 21 minutes ago Up 21 minutes (healthy) 0.0.0.0:80-\>80/tcp, 0.0.0.0:443-\>443/tcp great\_cohen  
[root@10.xx.xx.xx ~]# docker exec -it great\_choen bash

env | grep GF

GF\_SMTP\_PASSWORD=  
GF\_SMTP\_HOST=mailrelay:25  
GF\_SMTP\_ENABLED=true  
[GF\_SMTP\_FROM\_ADDRESS=pmm-noreply@test.com](mailto:GF_SMTP_FROM_ADDRESS=pmm-noreply@test.com)  
GF\_PLUGIN\_DIR=/srv/grafana/plugins  
GF\_SMTP\_FROM\_NAME=Percona Alerting  
GF\_SMTP\_SKIP\_VERIFY=true  
GF\_SMTP\_USER=

We have other security measures to ensure the relay is not a spambot so it does not require authentication.

I ran the telnet test as requested in the pmm container

[root@29d03a8dfe81 opt] # telnet mailrelay 25  
Trying 10.x.x.x…  
Connected to mailrelay.  
Escape character is ‘^]’.  
220 mailrelay ESMTP Postfix  
helo test  
250 mailrelay  
mail from: [test@test.com](mailto:test@test.com)  
250 2.1.0 Ok  
rcpt to: [test@test.com](mailto:test@test.com)  
250 2.1.5 Ok  
data  
354 End data with .  
subject: test from pmm  
test message from pmm docker

.  
250 2.0.0 Ok: queued as 7341E3803F2C

Mail was received.

Still getting that SMTP not configured error. Looking in the container at what should be the grafana.ini at /etc/grafana/grafana.ini I still don’t see and SMTP section.

I also tried adding a fake user/password, same result.

I’m using the same mail configuration in a promethus alertmanager setup side by side with the percona postgres operator + PMM with out issues. It seems like there is something that is not taking the environment variables and placing them in the grafana.ini when using the docker setup.

From alertmanager

```
     - smarthost: 'mailrelay:25'
       from: 'pmm-noreply@test.com'
       to: 'test@test.com'
       headers:
         subject: 'alerts'

```

Thanks again for taking time to look at this issue.

---

<div class="post-metadata">

### Author: ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)
#### Post date: [August 30, 2024, 12:43pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/6 "2024-08-30T12:43:03Z")

</div>

Ok…that seems to say that grafana isn’t picking up the env vars on container start.

You can try this but it’d be only a test:

get a shell inside the container  
Directly edit the grafana.ini values  
use supervisorctl restart grafana  
test

that should keep the changes long enough to test with and it should work until you update the container (where that edited file would be replaced with the default one). if that works we may have to open a bug with the PMM team ([https://jira.percona.com](https://jira.percona.com) but lets hope it’s not that).

---

<div class="post-metadata">

### Author: ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)
#### Post date: [August 30, 2024, 12:49pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/7 "2024-08-30T12:49:36Z")

</div>

also you can see if grafana is picking up the overrides here:

https:///graph/admin/settings

look in the SMTP section (I think we know it’s not but just an easy place to verify in the future).

---

<div class="post-metadata">

### Author: ![Lobo\_Lobo20919](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lobo_lobo20919/32/14572_2.png) [@Lobo\_Lobo20919](https://forums.percona.com/u/Lobo_Lobo20919)
#### Post date: [September 6, 2024, 12:58pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/8 "2024-09-06T12:58:56Z")

</div>

Yes that test worked!

We really do need a bug report but I don’t have access to jira so I can only put one in on github.

I have an automated process that builds postgres clusters and adds PMM for various business units. The business units treat it as a black box so our automation needs to be able to fully set up a working pmm, which makes any manual work a problem.

Thanks again for all your help.

---

<div class="post-metadata">

### Author: ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)
#### Post date: [September 6, 2024, 1:07pm UTC](https://forums.percona.com/t/trouble-with-smtp-contact-point-in-pmm-2-42-0/32659/9 "2024-09-06T13:07:59Z")

</div>

Our jira is public so you can register for an account and submit a bug there. I do believe the PMM team monitors github issues and converts to Jira issues so if you’ve already submitted a GH issue, they’ll get it.
