Open konate58 opened 1 month ago
Hello, there are basically two ways to run this:
go run .
in the directory. docker build -t prom2mqtt .
followed by docker run prom2mqtt
should do the trick. The path to the configuration file can be set via the environment variable PROM2MQTT_CONFIG_PATH
. By default the program will look for the configuration at ./prom2mqtt.config.yaml
. When running with docker
or podman
the config file will need to be mounted into the container.
Just for completeness, your configuration should look like this:
mqtt:
url: "mqtt://localhost:1883"
username: "ke......"
password: "M......"
prometheus:
url: "http://localhost:9095/metrics"
topics:
sample-topic:
- name: "prometheus2mqtt" # this is the name of your prometheus metric
labels:
- name: "instance"
value: "raspi"
Does this help you? :)
Hello,
thanks for your feedback and disponibility, I appreciate. I can see the connexion to my mqtt server but no information about topics.
There is no topics added.
Here is my final configuration:
mqtt: url: "mqtt://localhost:1883" username: "ke......" password: "M......" prometheus: url: "http://localhost:9095/metrics" topics: topic:
When I query with this: openweather_temperature{instance="localhost:9095"}
in prometheus I get :
Result series: 12 openweather_temperature{instance="localhost:9095", location="Giustiniana, IT "} 32.12 openweather_temperature{instance="localhost:9095", location="Giustiniana, IT "} 31.88 openweather_temperature{instance="localhost:9095", location="Giustiniana, IT "} 31.84 openweather_temperature{instance="localhost:9095", location="Giustiniana, IT "} 31.58 openweather_temperature{instance="localhost:9095", location="Giustiniana, IT "} 31.79 openweather_temperature{instance="localhost:9095", location="Giustiniana, IT "} 31.18 openweather_temperature{instance="localhost:9095", location="Ouakam, SN "} 31.95 openweather_temperature{instance="localhost:9095", location="Ouakam, SN "} 31.95 openweather_temperature{instance="localhost:9095", location="Ouakam, SN "} 26.37 openweather_temperature{instance="localhost:9095", location="Ouakam, SN "} 32.95 openweather_temperature{instance="localhost:9095", location="Ouakam, SN "} 32.95 openweather_temperature{instance="localhost:9095", location="Ouakam, SN "} 32.95
Regards
Cheikh
Hello, thanks for this good job. How to run application with the configuration file ? I have some issues: nithing in my mqtt server. I use mosquitto
with this config: mqtt: url: "mqtt://localhost:1883" username: "ke......" password: "M......" prometheus:
Regards