我正在尝试通过prometheus docker映像进行连接以获取端点指标。以下是我的yml文件。但是我从普罗米修斯那里得到了错误Get http://localhost:8080/assessments/metrics: dial tcp 127.0.0.1:8080: connect: connection refused
。如果我从浏览器执行此操作,它将运行。我该如何映射端口,以便docker识别。
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'assessments'
metrics_path: /assessments/metrics
static_configs:
- targets: ['localhost:8080']
~
答案 0 :(得分:1)
我能够通过用docker.for.mac.localhost:8080
修改yml来解决此问题。这使它意识到必须在mac中寻找端口8080