我正在运行一个带有这些映像的Docker包
- SpringBoot app : PORT 18081
- Granafa : PORT 3001
- PostgreSQL : PORT 5432
- Prometheus : PORT 9090我想设置Prometheus,使用这个prometheus.yml配置从Springboot中抓取:
#My global config
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: spring-actuator
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: /actuator/prometheus
scheme: http
static_configs:
- targets: ['172.30.0.9:18081']其中,172.30.0.9是通过以下命令获得的SpringBoot应用程序的内部IP:
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container-id>我查看了ip:9090上的Prometheus仪表板,我能够观察到prometheus的工作已经被成功地取消了,但是没有Spring应用程序的端点。
但是,如果我在VM机器curl http://172.30.0.9:18081/actuator/prometheus上执行卷曲,就会成功地返回所有prometheus度量。
我曾试图设定以下目标:
但是Prometheus仍然没有像预期的那样访问端点。
我错过什么要配置的了吗?
发布于 2022-11-28 12:05:26
我看到一些您可能删除的东西,因为它们是多余的,您可以尝试在scrape_configs中使用以下内容(prometheus自刮是不必要的,还有一些设置--因为您定义了全局的):
scrape_configs:
- job_name: 'spring-actuator'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['172.30.0.9:18081']可能是布局问题。
https://stackoverflow.com/questions/74593373
复制相似问题