How to setup prometheus metrics?


could anyone please explain how to setup the prometheus metric system? So far I’ve added

  # Enable Prometheus metrics endpoint.

  # The ip:port to bind the Prometheus metrics server to for serving the
  # metrics endpoint.


to the lora-app-server.toml and

   - job_name:       'loraserver'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

  - targets: ['']

for Prometheus. Unfortunately no metrics are collected and the target is flagged “down” in Prometheus.

You might want to use 127 instead of 172 :wink: Also, if both instances are running on the same server then you need to use different ports.

After fixing your config, you can test the endpoint with:

curl http://localhost:8070

Where 8070 is the port you have configured for the metrics.

1 Like

Thank god that was just a stupid typo and not the problem :crazy_face:

Also, if both instances are running on the same server then you need to use different ports.

Prometheus and lora-app-server? Isn’t that an open port / connect to port relation? :thinking: I’m confused now, but I think that is due to the temperature. Do we have a sweating smiley btw?

On topic again: During writing the response and trying a few things I think I just found the problem and it is nearly as simple as the typo. I have two app-server instances which are both 3.x.0, but the one I choose for testing is only 3.1.0…

With this I mean when you both try to export the loraserver and lora-app-server metrics, then they can’t bind to the same port. E.g. use 8070 and 8071 and then configure Prometheus to scrape from both ports :slight_smile:

Sorry I am missing something. Do I need to install prometheus or is this already running on the server?
I am suspecting something is already running to produce the graphs on the lora packets in the gateway page of chirpstack.

Yes, this is standalone app.