sapcc / mosquitto-exporter

Prometheus metrics exporter for the Mosquitto message broker
Apache License 2.0
130 stars 60 forks source link

how do i configure mosquitto-exporter ? #35

Open ismaileneskirli opened 3 years ago

ismaileneskirli commented 3 years ago

Thanks for your work, i want to use your repo for my project, how do i configure this repo according to my mqtt broker ? any help is appreciated

msrn commented 2 years ago

Somewhat old issue but here's my configuration:

You run the docker image by giving the hostname of your mosquitto broker. Taken from readme.md

docker run --name mosquitto-exporter \
  -p 9234:9234 sapcc/mosquitto-exporter \
  --endpoint tcp://mosquitto:1883

Then you need to configure prometheus.yml with correct scrape configs.

scrape_configs:
  - job_name: 'mosquitto-exporter'
    static_configs:
      - targets: ['mosquitto-exporter:9234']
        labels:
         group: 'mosquitto-exporter'
    metrics_path: '/metrics'
    scheme: 'http'
Strykar commented 1 year ago

@msrn The README should include this, thanks!

ww7 commented 10 months ago

For example, with Netdata you can run it as

docker run -d --restart unless-stopped --name mosquitto-exporter-prometeus --network="if mosquitto in docker" -p 127.0.0.1:9234:9234 sapcc/mosquitto-exporter --endpoint tcp://<container name or IP>:1883 --user $user --pass $pass