prometheus.yml 中指定的 Prometheus 目标中的端点 IP 未更改
Endpoint IP not changed in Prometheus target specified in prometheus.yml
我想在我的 spring 引导项目中使用 Prometheus,我是 Prometheus 的新手,所以我不知道为什么会出现图片中描述的错误
我的prometheus.yml如下
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'spring_micrometer'
metrics_path: '/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['192.168.43.71:8080/app']
我运行 prometheus 通过这个命令docker run -d -p 9090:9090 -v <path-to-prometheus.yml>:/etc/prometheus/prometheus.yml prom/prometheus
我注意到我的 IP 没有显示在 Prometheus 目标页面中:
通常端点 IP 必须像 192.168.43.71:8080/app/actuator/prometheus
但我得到 http://localhost:9090/metrics
,当我点击它时,我得到图 1 中描述的错误
我做错了什么?!谁能帮我解决这个问题,谢谢。
你不能这样做- targets: ['192.168.43.71:8080/app']
。尝试以下操作:
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'spring_micrometer'
metrics_path: '/app/actuator/prometheus/metrics'
scrape_interval: 5s
static_configs:
- targets: ['192.168.43.71:8080']
为什么你的配置不起作用?在此处查看配置文档:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#host
targets
是 host
的集合,host
必须是“由主机名或 IP 后跟可选端口号组成的有效字符串”。
我想在我的 spring 引导项目中使用 Prometheus,我是 Prometheus 的新手,所以我不知道为什么会出现图片中描述的错误
我的prometheus.yml如下
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'spring_micrometer'
metrics_path: '/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['192.168.43.71:8080/app']
我运行 prometheus 通过这个命令docker run -d -p 9090:9090 -v <path-to-prometheus.yml>:/etc/prometheus/prometheus.yml prom/prometheus
我注意到我的 IP 没有显示在 Prometheus 目标页面中:
通常端点 IP 必须像 192.168.43.71:8080/app/actuator/prometheus
但我得到 http://localhost:9090/metrics
,当我点击它时,我得到图 1 中描述的错误
我做错了什么?!谁能帮我解决这个问题,谢谢。
你不能这样做- targets: ['192.168.43.71:8080/app']
。尝试以下操作:
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'spring_micrometer'
metrics_path: '/app/actuator/prometheus/metrics'
scrape_interval: 5s
static_configs:
- targets: ['192.168.43.71:8080']
为什么你的配置不起作用?在此处查看配置文档:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#host
targets
是 host
的集合,host
必须是“由主机名或 IP 后跟可选端口号组成的有效字符串”。