Mali
Mali

Reputation: 61

Prometheus listening different ports at same time

I am trying to listen 2 ports at same time ports are: http://localhost:9182/metrics http://localhost:8080/prometheus Can anyone suggest a good way?

Upvotes: 0

Views: 2882

Answers (1)

weibeld
weibeld

Reputation: 15232

You could try the following Prometheus config file:

scrape_configs:
  - job_name: job1
    static_configs:
      - targets:
        - localhost:9182
  - job_name: job2
    metrics_path: /prometheus
    static_configs:
      - targets:
        - localhost:8080

Since the targets use different metrics paths (/metrics vs. /prometheus), they must be defined in separate jobs. /metrics is the default metrics path, so you don't need to configure it in job1, but you need to configure /prometheus as the metrics path in job2.

Upvotes: 2

Related Questions