0

I am new to Prometheus and YAML, and am getting started with setting up Prometheus on one of the linux server with say IP address: XXX

This is my YAML file:

global:
  scrape_interval: 10s
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ["XXXX:9092"]

As you can see, I am trying to start prometheus on IP XXX and not "localhost" and also port is 9092.

But in the logs I am always seeing this line: level=info component=web msg="Listening on" address=0.0.0.0:9090

What am I missing? If my YAML configuration wrong?

I have tried with another config file, like the following:

 global:
   scrape_interval: 10s
 scrape_configs:
   - job_name: prometheus
     static_configs:
       - targets:
          - XXX:9092

I always get the same INFO that prometheus is listening on 0.0.0.0:9090

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

1

All you've done is define a external server with port 9092 for Prometheus to scrape from itself.

You don't set Prometheus bind address / server port from scrape_configs. And it should collect metrics from itself, by default.

To change Prometheus http port, and make it externally accessible (localhost doesn't matter, as the logs say, it's already bound to all external interfaces, including "IP XXX") see Configure Prometheus to use non-default port

Aside: port 9092 is the default of Apache Kafka, which doesn't expose a endpoint that can be scraped for metrics

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245