Commit Graph

42 Commits

Author SHA1 Message Date
Volker Gropp
656f219bc6 fixes #178 doc for raw_expressions
fixes docker documentation for raw_expressions use
2025-11-15 10:38:13 +01:00
Jérôme LOYET
ce77333416 add dynamic labels 2025-01-17 05:56:27 +01:00
Jérôme LOYET
5ede83bcb7 add raw_expression 2025-01-01 09:01:41 +01:00
Jérôme LOYET
d28d6cd818 make error_value global to metric
* fail if both metric.error_value and
  metric.string_value_mapping.error_value are set
* mark metric.string_value_mapping.error_value as deprecated
2024-12-30 09:53:12 +01:00
Christoph Petrausch
0137ffc738 Merge pull request #143 from chrschn/expressions
Expressions
2024-05-19 20:18:38 +02:00
Christoph Petrausch
e748c6f823 Merge pull request #147 from podorozhny/patch-1
fix typo
2024-03-25 10:28:16 +01:00
Christian Schneider
f380bea81d Support metrics from arithmetic expressions.
This change adds the new metric config option `expression` which can
define a complex expression to calculate the final metric value. The
expression is evaluated using github.com/antonmedv/expr as the engine,
see expr-lang.org/docs/v1.9/Language-Definition for a language overview.
In addition, some basic functions are available during evaluation: now,
int, float, round, ceil, floor, abs, min, max.

For each evaluation, the expression gets:
- the current MQTT value
- the last MQTT value
- the result of the last evaluation
- the elapsed time since the last evaluation

Expressions allow more flexibility to derive metrics from sensor inputs
which are very hard or even impossible to do in Prometheus, for example,
integrate continuous values over time, filter extreme or zero values, or
non-linear scaling. The last value, result, and timestamp are preserved
even between restarts of mqtt2prometheus. This means that expressions
can be used to produce continuous time series over a long time range.

To make upstream integration easier, the code depends on the rather old
v1.8.9 of github.com/antonmedv/expr, which is available in the main repo
of all supported Debian versions.
2024-03-25 10:15:05 +01:00
Ivan Podorozhnyi
8b38164ec4 Update Readme.md 2024-03-01 23:20:14 +01:00
Christian Schneider
4943c97963 Add option to enforce strict monotonicy in metrics.
This change adds the new option `force_monotonicy` to metric
configurations. It is intended for almost-but-not-really monotinic
sources, such as counters which reset when the sensor is restarted.

When this option is set to `true`, the source metric value is regularly
written to disk. This allows us to detect and compensate counter resets
even between restarts. When a reset is detected, the last value before
the reset becomes the new offset, which is added to the metric value
going forth.  The result is a strictly monotonic time series, like an
ever increasing counter.
2024-02-05 21:04:52 +01:00
yan
9da7b1b379 Handle json payload in metric_per_topic mode 2024-02-05 21:04:52 +01:00
dmolle
d562b927f8 Update Readme.md
JSON needs to be upper case, otherwiese "could not setup a metric extractor	{"error": "unsupported object format: json"} " is thrown.
2024-02-05 21:04:52 +01:00
Christoph Petrausch
b27f5a8c2e Merge pull request #131 from y-martin/jsonpayload-metric-per-topic
Handle json payload in metric_per_topic mode
2023-12-14 22:50:44 +01:00
Christoph Petrausch
f6b8e4dbb1 Merge pull request #129 from dmolle/patch-1
Update Readme.md: object_per_topic_config: encoding need to be upper case
2023-12-14 22:48:48 +01:00
Tim Buchwaldt
74563f1caa Fix typo 2023-04-24 07:58:30 +02:00
yan
51b627abce Handle json payload in metric_per_topic mode 2023-04-19 01:06:13 +02:00
dmolle
ced08556ab Update Readme.md
JSON needs to be upper case, otherwiese "could not setup a metric extractor	{"error": "unsupported object format: json"} " is thrown.
2023-04-01 01:32:24 +02:00
mvadu
76aaeff1ff typo in readme 2023-01-30 09:32:25 -05:00
mvadu
3cf984104a handle review comments 2023-01-30 09:27:24 -05:00
mvadu
9f6f38263c add support for reading mqtt password from file 2023-01-25 00:02:48 -05:00
Will Moss
617d0cdd08 Add *_per_topic_config to the Readme 2023-01-01 11:47:06 -08:00
alessandro negrin
6711228d69 readme update 2022-12-01 10:36:47 +01:00
alessandro negrin
e76641898a scale as a multiplier 2022-11-29 16:18:03 +01:00
alessandro negrin
a889c7769b updated readme 2022-11-28 18:43:30 +01:00
Christoph Petrausch
06cde09749 Changed wording to expose prometheus metrics
Before, the confusing "publish prometheus metrics was used"

Fixes #80
2022-02-02 08:08:27 +01:00
Christoph Petrausch
4b660055f0 Refactor documentation
Fixes #46
2022-01-04 10:14:27 +01:00
Valdimar Björn Ásgeirsson
83413b19e2 Update readme for env vars
Describe how to supply MQTT username and password via environment variables.
2021-09-20 13:12:15 +00:00
Christoph Petrausch
6c7f7f7af1 Update Readme 2021-03-12 20:22:26 +01:00
Christoph Petrausch
62f606ee42 Fix docs 2021-02-28 20:03:06 +01:00
Christoph Petrausch
4a90c02d8d Update Readme.md
Make readme consistent. Fix #35
2021-01-26 08:59:41 +01:00
Christoph Petrausch
6de0a07119 Update docs
fixes #21
2020-11-01 21:06:03 +01:00
Christoph Petrausch
6c6c9386c3 Add supported go versions notification 2020-09-19 23:49:31 +02:00
Paul Rogalinski-Pinter
a9e61fe42a clarified usage of topic wildcard in examples/doc 2020-09-01 22:33:52 +02:00
Christoph Petrausch
0d8d9e373c Add a link to the hacking environment
Increase the visibility of the hacking enviroment. 

Fixes #15
2020-08-12 08:22:26 +02:00
Christoph Petrausch
e5431f2fe5 Update Readme.md 2020-07-18 20:43:13 +02:00
Christoph Petrausch
cdb02b9efe Updated readme 2020-07-18 20:13:23 +02:00
Christoph Petrausch
2f2a8de37e Fix port in docker run 2020-07-16 14:43:37 +02:00
Christoph Petrausch
451f4c0ce1 Change default port as suggested in https://github.com/prometheus/docs/pull/1649
Updated documentation
2020-06-09 16:18:11 +02:00
Christoph Petrausch
708c89f0a9 Add goreleaser file and badges 2020-04-21 22:34:02 +02:00
Christoph Petrausch
bae13a6124 Added public docker image 2018-06-15 12:03:22 +02:00
Christoph Petrausch
6aaf01fdb8 Fixed typo 2018-03-18 13:45:11 +01:00
Christoph Petrausch
02cd0ce4a2 Updated readme 2018-03-18 13:42:04 +01:00
Christoph Petrausch
7d41c58d70 Initial commit 2018-03-18 13:20:49 +01:00