从 grafana 发送邮件的问题

Posted

技术标签:

【中文标题】从 grafana 发送邮件的问题【英文标题】:Issue with sending mails from grafana 【发布时间】:2018-06-04 20:50:39 【问题描述】:

我正在尝试从 grafana 发送邮件,但出现以下错误。

t=2017-12-22T07:24:46+0000 lvl=eror msg="发送警报通知失败" logger=context userId=1 orgId=1 uname=admin error="534 5.7.14 请登录通过您的网络浏览器,然后\n5.7.14 然后重试。\n5.7.14 了解详情,请访问\n5.7.14 https://support.google.com/mail/answer/78754 j27sm22594347eda.59 - gsmtp"

谁能帮忙?

【问题讨论】:

检查 grafana.ini 配置文件的 [smtp] 部分并确认那里的 SMTP 配置设置正确。该文件位于/etc/grafana/grafana.ini 这是我的 smtp 配置...[smtp] enabled = true host = smtp.gmail.com:587 user = xxxx # 如果密码中包含 # 或 ;你必须用trippel引号包裹它。 Ex """#password;""" password = yyyy ;cert_file = ;key_file = skip_verify = true from_address = xxxx from_name = Grafana # SMTP 对话框中的 EHLO 身份(默认为 instance_name);ehlo_identity = dashboard.example.com 【参考方案1】:

我在尝试向 gmail 帐户发送邮件提醒时遇到了同样的错误。 在 Gmail 设置中启用 IMAP 并启用“允许不太安全的应用程序访问您的帐户”选项为我解决了这个问题。

错误日志中提供的链接中提供了有关如何启用上述两个选项的详细信息: https://support.google.com/mail/answer/7126229?visit_id=1-636650859449850569-2622875240&rd=2#cantsignin

按照建议从链接中添加详细信息:

1) 设置 IMAP:检查 IMAP 是否已打开

On your computer, open Gmail.
In the top right, click Settings Settings.
Click Settings.
Click the Forwarding and POP/IMAP tab.
In the "IMAP Access" section, select Enable IMAP.
Click Save Changes.

2) 启用“允许不太安全的应用访问您的帐户”

更改您的设置以允许安全性较低的应用进入您的帐户。我们不推荐使用此选项,因为它可以让某人更容易侵入您的帐户。如果您仍然想允许访问,请按照以下步骤操作:

Go to the Less secure apps section of your Google Account.
Turn on Allow less secure apps. If you don't see this setting, your administrator might have turned off less secure app account access.

【讨论】:

虽然此链接可能有助于您回答问题,但您可以通过获取链接的重要部分并将其放入您的答案来改进此答案,这样可以确保您的答案仍然是一个答案,如果链接被更改或删除:)【参考方案2】:

我最初在这个问题上遇到了很多困难。 解决方案很简单。 启用“允许不太安全的应用程序访问您的帐户”可以解决问题。 还要确保没有 2 因素身份验证。

【讨论】:

这并没有提供问题的答案。一旦你有足够的reputation,你就可以comment on any post;相反,provide answers that don't require clarification from the asker。 - From Review

以上是关于从 grafana 发送邮件的问题的主要内容,如果未能解决你的问题,请参考以下文章

Grafana(在 openshift 中) - 错误 msg="异步发送电子邮件 0 成功,不发送电子邮件:...."

如何在 Grafana 的单个警报通知电子邮件中发送多个值?

使用 prometheus-alertmanager 通过 Grafana UI 发送警报电子邮件

Granfana设置邮件告警

Grafana 邮件告警配置

如何在使用 grafana 和 prometheus-operator 时配置电子邮件警报