0

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?

Mali
  • 49
  • 1
  • 1
  • 11
  • 1
    Could you give more information I.e are those Prometheus ports you are trying to expose, are you trying to scrape both those endpoints etc – Spazzy757 Sep 17 '19 at 08:28
  • 9182 is wmi exporter for monitoring my windows machine 8080 is Spring Boot program shows some Counters and Gouges – Mali Sep 17 '19 at 08:37

1 Answers1

2

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.

weibeld
  • 13,643
  • 2
  • 36
  • 50