Comments (11)
To use the filter you simply need to put the original topic in: MQTT_IGNORED_TOPICS
.
I don't know what is the original topic in your case from the info you provided.
I have a docker compose mqtt-exporter setup, how could I implement that pull request?
The easiest way is to
- git clone the repository
- checkout the
crash_bad_char_metric_name
branch - run the docker compose with
docker-compose.dev.yml
file
As an example, I have myself a docker-compose with both stable mqtt-exporter + the dev version built from the disk:
version: "3"
services:
mqtt-exporter:
image: kpetrem/mqtt-exporter
environment:
...
mqtt-exporter-dev:
build: /home/kevin/dev/mqtt-exporter
environment:
...
from mqtt-exporter.
perfect! it doesn't crash anymore, thank you for this amazing fix!
from mqtt-exporter.
you are welcome.
This has been included in the release 1.2.0
from mqtt-exporter.
I need at least a workaround to exclude certain metric to be picked up by mqtt-exporter, how can I achieve that?
from mqtt-exporter.
hello @amigthea,
Thanks for raising the issue.
mqtt_cpu_usages_%Cpu:_mem
means that your original topic was cpu_usages_%Cpu:_mem
.
%
is not a valid character for Prometheus. See details here.
from mqtt-exporter.
#56 should fix your issue. Could you please try?
from mqtt-exporter.
hello @amigthea,
Thanks for raising the issue.
mqtt_cpu_usages_%Cpu:_mem
means that your original topic wascpu_usages_%Cpu:_mem
.%
is not a valid character for Prometheus. See details here.
#56 should fix your issue. Could you please try?
hi @kpetremann and thank you for joining the discussion
It's indeed a kind of metric not parsed for prometheus, I was trying to figure out a workaround on how to esclude that topic with the MQTT_IGNORED_TOPICS enviroment variable, but I'll gladly try out that fix instead!
I have a docker compose mqtt-exporter setup, how could I implement that pull request?
from mqtt-exporter.
That's awesome, thank you for that workflow! However now I get a KeyError
instead of a ValueError
INFO:mqtt-exporter:creating prometheus metric: mqtt_detectors_coral_inference_speed
INFO:mqtt-exporter:creating prometheus metric: mqtt_detectors_coral_detection_start
INFO:mqtt-exporter:creating prometheus metric: mqtt_detectors_coral_pid
INFO:mqtt-exporter:creating prometheus metric: mqtt_detection_fps
INFO:mqtt-exporter:creating prometheus metric: mqtt_cpu_usages_Tasks:_mem
INFO:mqtt-exporter:creating prometheus metric: mqtt_cpu_usages_Cpu:_mem
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 365, 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 320, in expose_metrics
_parse_metrics(payload, topic, userdata["client_id"])
File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 151, in _parse_metrics
_parse_metrics(value, topic, client_id, f"{prefix}{metric}_")
File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 151, in _parse_metrics
_parse_metrics(value, topic, client_id, f"{prefix}{metric}_")
File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 171, in _parse_metrics
_add_prometheus_sample(topic, prom_metric_name, metric_value, client_id)
File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 105, in _add_prometheus_sample
prom_metrics[prom_metric_name].labels(**labels).set(metric_value)
KeyError: 'mqtt_cpu_usages_%Cpu:_mem'
mqtt-exporter-dev exited with code 0
from mqtt-exporter.
ok I see. I'll fix that.
@amigthea could you provide the original MQTT message please? It could help to add a functional test.
from mqtt-exporter.
actually it is not needed. I have an easy way to test that.
from mqtt-exporter.
should be better now. Could you git pull
and try again?
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
- ValueError: Invalid metric name with '/' HOT 9
- Pin dependencies version
- 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.