You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+18-2
Original file line number
Diff line number
Diff line change
@@ -288,6 +288,17 @@ metrics:
288
288
type: counter
289
289
# This setting requires an almost monotonic counter as the source. When monotonicy is enforced, the metric value is regularly written to disk. Thus, resets in the source counter can be detected and corrected by adding an offset as if the reset did not happen. The result is a true monotonic increasing time series, like an ever growing counter.
290
290
force_monotonicy: true
291
+
- prom_name: linky_time
292
+
# The name of the metric in a MQTT JSON message
293
+
mqtt_name: linky_current_date
294
+
# Regular expression to only match sensors with the given name pattern
295
+
sensor_name_filter: "^linky.*$"
296
+
# The prometheus help text for this metric
297
+
help: current unix timestamp from linky
298
+
# The prometheus type for this metric. Valid values are: "gauge" and "counter"
299
+
type: gauge
300
+
# convert dynamic datetime string to unix timestamp
@@ -335,13 +346,18 @@ Create a docker secret to store the password(`mqtt-credential` in the example be
335
346
336
347
### Expressions
337
348
338
-
Metric values can be derived from sensor inputs using complex expressions. Set the metric config option `expression` to the desired formular to calculate the result from the input. Here's an example which integrates all positive values over time:
339
-
349
+
Metric values can be derived from sensor inputs using complex expressions. Set the metric config option `raw_expression` or `expression` to the desired formular to calculate the result from the input. `raw_expression` and `expression` are mutually exclusives:
350
+
* `raw_expression` is run without raw value conversion. It's `raw_expression` duty to handle the conversion. Only `raw_value` is set while `value` is always set to 0.0. Here is an example which convert datetime (format `HYYMMDDhhmmss`) to unix timestamp:
* `expression` is run after raw value conversion. If conversion fails, `expression` is not run. Here's an example which integrates all positive values over time:
logger.Warn("string_value_mapping.error_value is deprecated: please use error_value at the metric level.", zap.String("prometheusName", m.PrometheusName), zap.String("MQTTName", m.MQTTName))
245
246
}
247
+
248
+
ifm.Expression!=""&&m.RawExpression!="" {
249
+
returnConfig{}, fmt.Errorf("metric %s/%s: expression and raw_expression are mutually exclusive.", m.MQTTName, m.PrometheusName)
0 commit comments