Comments (9)
hello @xaxeu,
Thanks for opening this issue.
This is because /
is not authorized in Prometheus metrics as explained in their documentation.
I can add a replace of /
to _
.
Would it be ok for you?
from mqtt-exporter.
from mqtt-exporter.
@xaxeu, could you please:
- share the configuration you used for the exporter (unless you kept the default values)
- give the version of mqtt-exporter you are using
This should already work as the replacement of \ to _ is already implemented.
I have added your case in unit tests, and I do see the relay/0
becoming relay_0
from mqtt-exporter.
The full stacktrace would also be useful please
from mqtt-exporter.
Hi,
Stacktrace:
Traceback (most recent call last): File "/opt/mqtt-exporter/exporter.py", line 5, in <module> main() File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 305, in main client.loop_forever() File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1756, in loop_forever rc = self._loop(timeout) File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1164, in _loop rc = self.loop_read() File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1556, in loop_read rc = self._packet_read() File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 2439, in _packet_read rc = self._packet_handle() File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle return self._handle_publish() File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish self._handle_on_message(message) File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message on_message(self, self._userdata, message) File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 260, in expose_metrics _parse_metrics(payload, topic, userdata["client_id"]) File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 138, in _parse_metrics _create_prometheus_metric(prom_metric_name) File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 71, in _create_prometheus_metric prom_metrics[prom_metric_name] = Gauge( File "/usr/local/lib/python3.10/site-packages/prometheus_client/metrics.py", line 365, in __init__ super().__init__( File "/usr/local/lib/python3.10/site-packages/prometheus_client/metrics.py", line 130, in __init__ raise ValueError('Invalid metric name: ' + self._name) ValueError: Invalid metric name: mqtt_relay/0
Configuration on docker-compose:
power_pump: image: kpetrem/mqtt-exporter:latest container_name: power_pump ports: - 9644:9000 environment: - MQTT_ADDRESS=xxxxxxxx - MQTT_PORT=xxxx - MQTT_TOPIC=PowerPUMP/measures/data restart: unless-stopped
I'm using latest tag version and I still dont' see the mqtt_relay_0 populated on Prometheus.
from mqtt-exporter.
can you provide me the output of docker compose images
command please? (or docker-compose images
if you still have the old version of compose)
I think you are still using an old version of the image. Maybe could you try to docker compose pull
?
Because, your stacktrace does not match the current code base:
File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 260, in expose_metrics _parse_metrics(payload, topic, userdata["client_id"])`
Actual code at line 260: # move availability suffix added by Zigbee2MQTT from topic to payload
File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 138, in _parse_metrics _create_prometheus_metric(prom_metric_name)`
Actual code at line 138: prom_metric_name = (
from mqtt-exporter.
Note: /
in the key is supported since this PR: #41.
from mqtt-exporter.
Not sure why docker-compose up -d <container> didn't update to the latest tag, but used the pull command and now I have the metric relay/0 being transformed to mqtt_relay_0 on Prometheus.
Thanks.
from mqtt-exporter.
👍
docker-compose up -d
never pulls the image. You have to do docker-compose pull
before.
You are welcome.
from mqtt-exporter.
Related Issues (20)
- Doesn't support Shelly 3EM format very well HOT 5
- Tag docker images with release version number HOT 5
- Once unavailable always unavailable even after becoming available in zigbee2mqtt HOT 9
- Support esphome format HOT 12
- Pin dependencies version
- crash loop with google coral metric HOT 11
- Hubitat support HOT 16
- emporiavue2/esphome support HOT 2
- HomeAssistant HOT 3
- Shelly Plus H&T topic format not working with exporter HOT 5
- Attach additional labels from message user properties HOT 1
- UserProperty attribute exception HOT 3
- zigbee2mqtt: Device renames HOT 1
- two additional projects can be added to supported projects HOT 1
- I can not connect HOT 4
- AttributeError: 'Properties' object has no attribute 'AssignedClientIdentifier' HOT 7
- # in MQTT_TOPIC not working. HOT 18
- Request to Publish Python Package on PyPI or Provide Linux Executable Release HOT 4
- Binary states from esphome fails to parse HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mqtt-exporter.