首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Prometheus (通过Docker) -反向代理(通过Apache)重定向问题

Prometheus (通过Docker) -反向代理(通过Apache)重定向问题
EN

Stack Overflow用户
提问于 2018-04-13 06:56:26
回答 1查看 2.2K关注 0票数 2

环境

操作系统: Redhat 7

ReverseProxy: Apache (仅限)

部署通过:码头

========================================================================

发行:

是否可以在Apache反向代理中进行更改,以便我可以通过

"http://myserverurl/prometheus“-> "http://myserverurl/prometheus/graph

而不是当前失败的

"http://myserverurl/prometheus“-> "http://myserverurl/graph”(失败)

反向代理之后,URL被重定向,/promethus消失。

在Grafana设置中,我可以添加如下选项

(#docker run -d -p 3000:3000 -name=grafana -e "GF_SERVER_ROOT_URL=http://0.0.0.0/grafana“grafana/grafana)

它允许我访问Grafana控制台。

"http://myserverurl/grafana“-> "http://myserverurl/grafana/login”(成功)

========================================================================

码头状态:

docker run -d --名为prometheus -p 9090:9090 prom/prometheus

测试了proxypass的配置:(不起作用)

ProxyPass /prometheus http://0.0.0.0:9090/prometheus

ProxyPassReverse /prometheus http://0.0.0.0:9090/prometheus

行动:

试图访问"http://myserverurl/prometheus

结果失败:

404页未找到

========================================================================

,但如果我按以下方式更改配置,它就能工作了:

ProxyPass / http://0.0.0.0:9090/

ProxyPassReverse / http://0.0.0.0:9090/

访问url "http://myserverurl/“-> "http://myserverurl/graph

结果成功:

========================================================================

还尝试了以下组合-不起作用:

ProxyPass /promethus/ http://0.0.0.0:9090/

ProxyPassReverse /promethus/ http://0.0.0.0:9090/

EN

回答 1

Stack Overflow用户

发布于 2019-02-05 15:13:32

为了让prometheus本身侦听/prometheus而不是/您需要添加一个运行时参数:

--web.route-prefix="prometheus"

--web.external-url="http://myserverurl/prometheus"

(至少是双星普罗米修斯-2.7)

Prometheus调用:

代码语言:javascript
复制
prometheus --web.listen-address="127.0.0.1:9090" --web.route-prefix="prometheus" --web.external-url="http://myserverurl/prometheus"

还添加了系统Apache rev代理:

代码语言:javascript
复制
ProxyPreserveHost On
ProxyRequests Off

ProxyPass        /prometheus http://127.0.0.1:9090/prometheus
ProxyPassReverse /prometheus http://127.0.0.1:9090/prometheus
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49811012

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档