alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Not send email: establish connection to server: dial tcp: i/o timeout"

Open serrrios opened this issue 4 years ago • 3 comments

Logs(log.level=debug) do not contain information on inaccessible hosts behind the relay. This snmp relay works fine on a neighboring host with zabbix.

  • System information: Linux 3.10.0-1160.11.1.el7.x86_64 x86_64

  • Alertmanager version: alertmanager, version 0.22.2 (branch: HEAD, revision: 44f8adc06af5101ad64bd8b9c8b18273f2922051) build user: root@b595c7f32520 build date: 20210602-07:50:37 go version: go1.16.4 platform: linux/amd64

  • Prometheus version: We use vmalerts.

  • Alertmanager configuration file:

global:
  resolve_timeout: 1m
  smtp_smarthost: 'smtp.example.ru:587'
#  smtp_smarthost: 'smtp.example.ru:25' -- similarly result
  smtp_from: '[email protected]'
  smtp_hello: 'example.ru'
----------------
    - match:
        job: blackbox_exporter
        owner: common
        env: prod
      receiver: 'example.email'
      continue: true
------------------
    - match:
        project: evo
        owner: profiteroles
 #       env: prod
      receiver: 'example.email'
      continue: true
-------------------
  - name: 'example.email'
    email_configs:
      - from: [email protected]
        to: [email protected]


* Logs:

Jun 15 20:14:58 rbpccdpas00038 alertmanager: level=error ts=2021-06-15T17:14:58.393Z caller=dispatch.go:310 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="example.email/email[0]: notify retry canceled after 2 attempts: establish connection to server: dial tcp: i/o timeout" Jun 15 20:14:58 rbpccdpas00038 alertmanager: level=error ts=2021-06-15T17:14:58.407Z caller=dispatch.go:310 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="example.email/email[0]: notify retry canceled after 2 attempts: establish connection to server: dial tcp: i/o timeout" Jun 15 20:14:58 rbpccdpas00038 alertmanager: level=error ts=2021-06-15T17:14:58.410Z caller=dispatch.go:310 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="example.email/email[0]: notify retry canceled after 2 attempts: establish connection to server: dial tcp: i/o timeout" Jun 15 20:15:08 rbpccdpas00038 alertmanager: level=error ts=2021-06-15T17:15:08.394Z caller=dispatch.go:310 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="example.email/email[0]: notify retry canceled after 2 attempts: establish connection to server: dial tcp: i/o timeout" Jun 15 20:15:08 rbpccdpas00038 alertmanager: level=error ts=2021-06-15T17:15:08.407Z caller=dispatch.go:310 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="example.email/email[0]: notify retry canceled after 2 attempts: establish connection to server: dial tcp: i/o timeout" Jun 15 20:15:08 rbpccdpas00038 alertmanager: level=error ts=2021-06-15T17:15:08.411Z caller=dispatch.go:310 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="example.email/email[0]: notify retry canceled after 2 attempts: establish connection to server: dial tcp: i/o timeout"

{CentOS7.9.2009}{N/A}{rbpccdpas00038}[root@alertmanager]$ telnet smtp.example.ru 25
Trying 193.48.160.126...
Connected to smtp.example.ru.
Escape character is '^]'.
220 1612.example.ru Microsoft ESMTP MAIL Service ready at Tue, 15 Jun 2021 20:25:30 +0300
{CentOS7.9.2009}{N/A}{rbpccdpas00038}[root@alertmanager]$ telnet smtp.example.ru 587
Trying 193.48.160.119...
Connected to smtp.example.ru.
Escape character is '^]'.
220 1605.example.ru Microsoft ESMTP MAIL Service ready at Tue, 15 Jun 2021 20:26:51 +0300
----------
Connecting to 193.48.160.130 on Port 25
220 1616.example.ru Microsoft ESMTP MAIL Service ready at Tue, 15 Jun 2021 20:34:30 +0300
250 1616.example.ru Hello [193.48.3.8]
250 2.1.0 Sender OK
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
250 2.6.0 <[email protected]> [InternalId=29334626632801, Hostname=1605.example.ru] 1685 bytes in 0.114, 14.374 KB/sec Queued mail for delivery
221 2.0.0 Service closing transmission channel

serrrios avatar Jun 15 '21 17:06 serrrios

Update /etc/systemd/resolved.conf

[Resolve] DNS=1.1.1.1 8.8.8.8 FallbackDNS=8.8.4.4

Restart system resolved: service systemd-resolved restart Run systemd-resolve --status

the output should look like this:

Global DNS Servers: 1.1.1.1 8.8.8.8

restart alertmanager service

minc84 avatar Jun 09 '22 23:06 minc84

same issue for me, have you resolved it ?

wenbya avatar Aug 31 '22 06:08 wenbya