Commit Graph
16 Commits
Author SHA1 Message Date
Christoph Petrausch e5cc73f9b2 Refactor cache datastructure to use a key per metric instead of a key per device
This should resolve #26
2021-01-23 22:09:33 +01:00
Christoph Petrausch ab0f600bfd Add unittests for parser 2020-11-08 22:50:07 +01:00
Christoph Petrausch be4af9ff5e Refactor metric extraction from MQTT
This commit allows to extract the metric name from the topic path. Now
it can be configured if all metrics are in a object in a certain topic
or if every topic contains exactly one metric. However, currently these
modes can not be mixed.

This should solve !26

TODO:
* Update documentation
* Add unit tests
2020-11-08 22:01:36 +01:00
Christoph Petrausch 126e13428b Use go.uber.org/zap for logging
As mentioned in https://github.com/hikhvar/mqtt2prometheus/issues/23, we
do not use any logging framework at all. This was fine for getting the
exporter startet. However, with inreasing load the logging must be
configureable. This PR is a start to replace all instances of
"log.Printf" with the zap logger. The current configuration parameters
are the log level and the log format (console, json). We might expose
the log configuration to the config file. But I think this is overkill
for the current state of the exporter.
2020-10-29 20:58:28 +01:00
Christoph Petrausch 800b8c0cc5 Append source topic to metrics 2020-07-18 18:28:52 +02:00
Christoph Petrausch f13c36ab4a Breaking: Don't append + automatically to the topic 2020-07-18 18:17:29 +02:00
Christoph Petrausch 29eb9250f6 Moved to gojsonq to support nested paths 2020-07-18 18:03:49 +02:00
Christoph Petrausch 5680206095 Support arbitrary position of device id in topic
The device firmware tasmota places the device ID in the middle of the
topic path. To support those devices to this commit introduce the
device_id_regex configuration. The old behavior of the last element of
the topic path is unchanged.
2020-07-18 18:02:17 +02:00
Christoph Petrausch ec23d61881 Rename RegexpFilter to use it for device id extraction too 2020-07-18 18:02:17 +02:00
Christoph Petrausch 627c52669a Update hack config 2020-07-16 14:42:38 +02:00
Mansour Behabadi 7b5796b042 Add sensor name filter config 2020-05-22 00:42:49 +10:00
Mansour Behabadi 6e6113efba Remove unused regex 2020-05-03 18:15:31 +10:00
Mansour Behabadi 13c47b498d Parse more value types
* Parse bools as 0 for false and 1 for true
* Allow mapping between string and float values
2020-05-03 18:11:09 +10:00
Paul Rogalinski-Pinter 1f5ee67214 make an attempt to parse string floats 2020-03-11 22:51:45 +01:00
Paul Rogalinski-Pinter e0e3cbf744 less strict json payload type validation
json properties without explicit metric mapping are no longer required
to be of float64 type and will be ignored.
2020-02-03 13:35:05 +01:00
Christoph Petrausch 7d41c58d70 Initial commit 2018-03-18 13:20:49 +01:00