Error with E-Mail Alerting

Hello,

I tried to configure Alerting in Grafana on my Ubuntu VM.

I edited /usr/share/grafana/conf/defaults.ini

Note: I censored the PW for the screenshot.

Then restarted grafana-server.service.

I configured a Notification Channel in Grafana.

image

But when I try to test it I get

image

If I look under Alert Rules I see

Execution Error: tsdb.HandleRequest() error parse “192.168.1.10:8086”: first path segment in URL cannot contain colon

Edit: after I changed my InfluxDB from 192.168.1.10:8086 to http://192.168.1.10:8086 I didn’t get this anymore but I still get the “Failed to send alert notifications” error.

Source: https://community.grafana.com/t/grafana-7-alerting-issue-error-tsdb-handlerequest-unsupported-protocol-scheme-influxdb/31226

at my Alert Rule.

Hope anyone can help.

Best regards Tobias

I also allowed less secure app access in Gmail.

The two errors are unrelated, though it sounds like you’ve fixed the InfluxDB query issue.

For the SMTP/emailing issue, there should be more details in your Grafana server log.

Yes InfluxDB issue is fixed.

Log entrys for SMTP issue:

t=2021-04-21T13:14:27+0000 lvl=info msg=“Sending alert notification to” logger=alerting.notifier.email addresses=[test.user.grafana@gmail.com] singleEmail=false

t=2021-04-21T13:14:37+0000 lvl=eror msg=“Failed to send alert notification email” logger=alerting.notifier.email error=“Failed to send notification to email addresses: test.user.grafana@gmail.com: dial tcp 64.233.166.109:587: i/o timeout”

t=2021-04-21T13:14:37+0000 lvl=eror msg=“failed to send notification” logger=alerting.notifier uid= error=“Failed to send notification to email addresses: test.user.grafana@gmail.com: dial tcp 64.233.166.109:587: i/o timeout”

t=2021-04-21T13:14:37+0000 lvl=eror msg=“failed to send notification” logger=alerting.notifier uid= error=“Failed to send notification to email addresses: test.user.grafana@gmail.com: dial tcp 64.233.166.109:587: i/o timeout”

t=2021-04-21T13:14:37+0000 lvl=eror msg=“Failed to send alert notifications” logger=context userId=1 orgId=1 uname=admin error=“Failed to send notification to email addresses: test.user.grafana@gmail.com: dial tcp 64.233.166.109:587: i/o timeout” remote_addr=192.168.1.101

t=2021-04-21T13:14:37+0000 lvl=eror msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=POST path=/api/alert-notifications/test status=500 remote_addr=192.168.1.101 time_ms=10004 size=48 referer=http://192.168.1.10:3000/alerting/notification/1/edit

I guess the issue should be clear based on the above messages? Grafana can’t establish a network connection to the SMTP server.

image

Sure, but if I try to ping the SMTP Server it works.

Do I have to configure anything else in Grafana? Any ideas?

Hm…not sure in that case. I do remember having issues connecting to Gmail’s SMTP server at some point in the past (not specifically from Grafana) - there appears to be some nuance regarding TLS and/or SSL depending on the port.

This is not particularly scientific, but you could try some combination of the following:

  • Comment out the cert_file and key_file options, given that you’re not using them (and I don’t think they should be necessary). Just to make sure Grafana isn’t doing something funny because the option is there but set to empty
  • Try to set a different startTLS_policy option
  • Try port 465 instead of 587 (SSL instead of TLS security)
  • Set skip_verify=false

Sorry I can’t really be of more help. Maybe someone out there has a “proven working” configuration for Gmail SMTP (we use AWS…)

Wrote the same instruction…then looked that yours has appeared.

Lie down, try not to cry, cry a lot, teehee

Yes, Tobias, try this and that should definitely help.

When I had problems with fetching gmail emails - changing port was the decision.

1 Like

I got the same problem in the latest version 8.0.6 Have you solved it ?

I’m getting a timeout error when send an alert of Test email notification from Grafana. Used YUM repo installation for Grafana service on RHEL 8 (red hat linux server) and updated grafana.ini . Not using any docker images .

[smtp]
enabled = true
host = **:587
user = ****
password = *****
skip_verify = false
from_address = noreply@
.com
from_name = Grafana

Tried with starttls = nostarttls option also in the same file but still getting the same error

logger=ngalert.notifier.email t=2023-03-30T09:05:03.607196208-05:00 level=error msg=“Missing receiver”
logger=ngalert.notifier.email t=2023-03-30T09:05:03.607257464-05:00 level=error msg=“Missing group labels”
logger=alertmanager org=1 t=2023-03-30T09:05:12.375168702-05:00 level=error component=alertmanager orgID=1 component=dispatcher msg=“Notify for alerts failed” num_alerts=16 err=“Email Alerts/email[0]: notify retry canceled due to unrecoverable error after 1 attempts: failed to send notification to email addresses: sanitized@jll.com: dial tcp xx.x.xxx.x:587: i/o timeout”
logger=context userId=1 orgId=1 uname=admin t=2023-03-30T09:05:13.608405778-05:00 level=info msg=“Request Completed” method=POST path=/api/alertmanager/grafana/config/api/v1/receivers/test status=408 remote_addr=xx.xx.xx.xx time_ms=10034 duration=10.034264628s size=500 referer=“http://xx.xx.xx.xx:3000/alerting/notifications/receivers/Email%20Alerts/edit?alertmanager=grafana” handler=/api/alertmanager/grafana/config/api/v1/receivers/test