如何编辑Grafana的松弛通知中的链接

qui*_*ram 19 grafana slack

我们正在使用Grafana 4,并通过Incoming Webhook实现了对松弛通道的警报通知.除非通知中的链接指向错误的位置,否则通知将按预期发送.例如,如果您采取以下测试通知:

在此输入图像描述

然后我希望链接[Alerting] Test notification指向Grafana服务器.但是,该链接中的主机是localhost.我认为这可能只是测试通知的一个问题,但这也会发生在真实的通知中:路径是正确的,但主机和端口是错误的(localhost:62033,有关完整的详细信息).

我试图找到配置此主机/端口的地方,没有运气.任何提示,以便如何解决这个问题?

提前致谢.

小智 20

您可以在ini文件中添加许多选项,告诉Grafana如何构建自引用URL:

#################################### Server ##############################
[server]
# Protocol (http or https)
protocol = http

# The http port  to use
http_port = 3000

# The public facing domain name used to access grafana from a browser
domain = localhost

# The full public facing url
root_url = %(protocol)s://%(domain)s:%(http_port)s/
Run Code Online (Sandbox Code Playgroud)

您应该首先设置protocol,http_port并设置domain正确的值.如果您在端口80或443上访问Grafana并且不想在URL中明确显示端口,则可以:%(http_port)root_url设置中删除.


dra*_*788 6

除了编辑之外grafana.ini,如果您在Docker容器中运行Grafana,您还可以使用环境变量将其传递到容器中(示例使用默认的grafana / grafana容器)。

docker run \ -d \ -p 3000:3000 \ --name=grafana \ -e "GF_SERVER_ROOT_URL=http://grafana.server.name:3000" \ grafana/grafana