Failed to send test alert.: the receiver timed out: failed to send notifications to email address: email@example.com: dial tcp x.x.x.x:587: i/o timeout

Description:

I’m trying to configure my PMM server’s contact point running inside docker container. I have already setup my SMTP using this config (Failed to send test alert.: SMTP not configured, check your grafana.ini config file's [smtp] section - #2 by Vadim_Yalovets), but when I click “Send Test Notification” I keep getting this error:

“Failed to send test alert.: the receiver timed out: failed to send notifications to email address: email@example.com: dial tcp x.x.x.x:587: i/o timeout”

I also have tried publishing the port 587 but still getting the same error.
Do you guys have any idea what the problem is? I can’t find any logs for this one.

Version:

{
  "version": "2.41.0",
  "server": {
    "version": "2.41.0",
    "full_version": "2.41.0-20.2312051804.9a3843d.el9",
    "timestamp": "2023-12-05T18:04:56Z"
  },
  "managed": {
    "version": "2.41.0",
    "full_version": "9a3843dc52af8ee2561ae2d1b3ee254e313ad493",
    "timestamp": "2023-12-05T18:04:58Z"
  },
  "distribution_method": "DOCKER"
}

Hi Elman,

It looks like a network issue. Could you install telnet package in the pmm-server docker and verify connection to a mail server?

yum install telnet
telnet smtp.gmail.com 587

Hi @Vadim_Yalovets ,

Thanks for the response, I think, I really do have problem with my docker, I can’t even install telnet. Did I miss something here? I just followed the instructions here Run Docker with data container

Regards

Hi Elman,
You can check connectivity with curl if you are unable to install telnet. Most of the distributions come with it pre-installed.
You can check connectivity by running :

curl -v smtp.gmail.com:587

Hi @smit.arora ,

Thanks for the response, I tried what you said but, unfortunately, I can’t even use curl.

When I tried it in the host machine it worked.

Do I need to enable something here?

This is what I executed for my PMM Server by the way.

docker run
–detach
–publish 80:80
–publish 443:443
–publish 587:587
–volumes-from pmm-data
–name pmm-server
–restart always
-e GF_SMTP_ENABLED=true
-e GF_SMTP_HOST=smtp.sendgrid.net:587
-e GF_SMTP_USER=xxxx
-e GF_SMTP_PASSWORD=xxxxx
-e GF_SMTP_SKIP_VERIFY=false
-e GF_SMTP_FROM_ADDRESS=xxxx@xxxx.xxx
-e GF_SMTP_FROM_NAME=Grafana
percona/pmm-server:2

Regards

You do not need to publish port 587 in your PMM server container unless you are planning on running an SMTP server inside the PMM server container that you want external servers to be able to connect to.

Since your host can reach out but your container cannot I’m suspicious of something like selinux or firewalld that might be preventing the container from going external (maybe a clue in your iptables --list -n?). i’ve also seen some instances where corporate proxies interfere and even though your host may be configured to proxy requests, your container isn’t getting routed correctly for outbound internet access.

I also notice that you’re configuring grafana to use smtp.sendgrid.net:587 as the outgoing smtp server but you’re testing against smtp.gmail.com:587. Assuming that’s correct, is grafana able to send to sendgrid as configured (best way I knwo to test is trying to reset a password via email)?

Hi @steve.hoffman , thanks for the insight.
I have solved my issue, I found this forum [SOLVED] “docker run -it alpine” cannot ping google.com - router/conf?, I just upgraded my machine’s Linux-kernel via apt-get update and ap-get upgrade and now it’s working.

For those who have similar issue, try upgrading your linux-kernel, it may help.

1 Like