我正在尝试同时监听2个端口: http://localhost:9182/metrics http://localhost:8080/prometheus 有人可以建议一个好方法吗?
答案 0 :(得分:1)
您可以尝试以下Prometheus config file:
scrape_configs:
- job_name: job1
static_configs:
- targets:
- localhost:9182
- job_name: job2
metrics_path: /prometheus
static_configs:
- targets:
- localhost:8080
由于目标使用不同的度量标准路径(/metrics
与/prometheus
),因此必须在单独的作业中定义它们。 /metrics
是默认的度量标准路径,因此您不需要在job1
中进行配置,但是需要将/prometheus
配置为job2
中的度量标准路径。