未配置 SMTP,请检查您的 grafana.ini 配置文件的 [smtp] 部分

Posted

技术标签:

【中文标题】未配置 SMTP,请检查您的 grafana.ini 配置文件的 [smtp] 部分【英文标题】:SMTP not configured, check your grafana.ini config file's [smtp] section 【发布时间】:2020-11-26 07:46:27 【问题描述】:

对于通知,我在 Grafana 中添加了通知通道,类型为电子邮件,然后单击“发送测试”按钮,但它给出了 -

SMTP not configured, check your grafana.ini config file's [smtp] section

我已将 Grafana 安装为 docker 容器,因此我进入容器并使用 SMTP 详细信息更新了 grafana.ini 文件并反映更改,使用 -

重新启动 Grafana
docker restart grafana

现在转到通知通道并单击“发送测试”,但仍然看到相同的错误。

请帮助了解这里可能出了什么问题,以及哪个日志文件(带有位置)来检查这里到底出了什么问题。

【问题讨论】:

以防万一,我一直在关注本教程 (techexpert.tips/es/grafana-es/…) 并收到该消息,直到我在 grafana.ini ";" 中意识到这一点也可以作为评论“#”(查看 2nd lmulligan 在 2017 年 5 月在 community.grafana.com/t/… 发表的评论)。 【参考方案1】:

我进入容器并使用 SMTP 详细信息更新了 grafana.ini 文件并反映更改

这不是容器的正确配置。使用环境变量。

【讨论】:

有文档提到要更改grafana.ini grafana.com/docs/grafana/latest/administration/configuration 如何使用环境变量来帮助解决这个问题?您能帮我了解如何为 SMTP 设置环境变量吗?【参考方案2】:
All options in the configuration file can be overridden using environment variables using the syntax:

GF_<SectionName>_<KeyName>

Where the section name is the text within the brackets. Everything should be uppercase, . and - should be replaced by _. For example, if you have these configuration settings:

# default section
instance_name = $HOSTNAME

[security]
admin_user = admin

[auth.google]
client_secret = 0ldS3cretKey

[plugin.grafana-image-renderer]
rendering_ignore_https_errors = true
You can override them on Linux machines with:

export GF_DEFAULT_INSTANCE_NAME=my-instance
export GF_SECURITY_ADMIN_USER=owner
export GF_AUTH_GOOGLE_CLIENT_SECRET=newS3cretKey
export GF_PLUGIN_GRAFANA_IMAGE_RENDERER_RENDERING_IGNORE_HTTPS_ERRORS=true

参考:https://grafana.com/docs/grafana/latest/administration/configuration/#configure-with-environment-variables

【讨论】:

以上是关于未配置 SMTP,请检查您的 grafana.ini 配置文件的 [smtp] 部分的主要内容,如果未能解决你的问题,请参考以下文章

无法使用 PHP SMTP 发送电子邮件。您的服务器可能未配置为使用此方法发送邮件

发送 AUTH LOGIN 命令失败。错误:无法使用 PHP SMTP 发送电子邮件。您的服务器可能未配置为使用此方法发送邮件

IPN 模拟器:“IPN 未发送,握手未验证。请检查您的信息。”

Teamviewer显示“未就绪,请检查您的连接”解决办法

忍者表格不提交

访问未配置。您的项目未启用 API (Google+ API)。请使用 Google Developers Console 更新您的配置