Commit Graph

32 Commits

Author SHA1 Message Date
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
Alf-Rune Siqveland
95bbd81f7d feat: Add configuration option to enable/disable profiling metrics
Added a new configuration `enable_profiling_metrics` which
enable/disable the default runtime metrics exported by the Prometheus
client package.

BREAKING CHANGE: Changed default behavior to exclude runtime metrics.
        Enable with enable_profiling_metrics configuration option.
Signed-off-by: Alf-Rune Siqveland <alf.rune@siqveland.no>
2024-08-18 12:44:23 +02: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
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
eyjhb
cdef831e44 removed unused formatter in logger.Warn 2022-11-07 13:24:31 +01:00
michey
4f1b56fe2f Add way to change default separator for json pathes 2021-12-24 23:39:43 +03:00
Valdimar Björn Ásgeirsson
c26207fff6 Read mqtt user and password from environment
Environment variables override config variables, if they exist
2021-09-20 12:42:43 +00:00
Christoph Petrausch
1de4d0b3d0 Add experimental support for web-config-file
Fixes #55
2021-03-21 22:16:42 +01:00
Christoph Petrausch
30a2180cfa Add mqtt2prometheus_connected gauge to represent connection state 2021-03-12 21:22:27 +01:00
Christoph Petrausch
bad19409eb Improve error handling in TLS setup 2021-03-12 20:23:13 +01:00
weboo
f5562d20fc modified to return error 2021-03-12 23:11:41 +09:00
weboo
605e631fb3 modified to return error 2021-03-12 22:33:21 +09:00
weboo
d5ee3e68f9 support for TLS client certificates 2021-03-12 21:51:57 +09:00
Christoph Petrausch
a4caaf59e0 Remove unused interface 2020-11-08 22:50:26 +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
25f213a37e Please the linter 2020-10-29 21:10:48 +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
dc07489237 Fix Sprintf 2020-09-19 23:41:55 +02:00
Christoph Petrausch
31b233b4b0 Support multiple mqtt2prometheus instances per host by incorporate the pid into the mqtt client ID 2020-09-19 23:39:22 +02:00
Christoph Petrausch
9e4ab531b7 Add version flag to commandline 2020-09-19 20:07:33 +02:00
Christoph Petrausch
f13c36ab4a Breaking: Don't append + automatically to the topic 2020-07-18 18:17:29 +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
627c52669a Update hack config 2020-07-16 14:42:38 +02:00
Christoph Petrausch
ecb0011f3f Merge pull request #13 from hikhvar/fix-docs
Change default port as suggested in https://github.com/prometheus/doc…
2020-06-09 16:18:45 +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
Mansour Behabadi
8d0c1e0f2b gofmt cmd/ 2020-05-22 00:43:09 +10:00
Christoph Petrausch
0b308a5ea3 Remove unused package 2020-04-21 22:07:31 +02:00
AchMenz
9ab1d2b479 time not only in minutes 2020-03-17 17:46:30 +01:00
AchMenz
9318832599 fixed cache-duration-always-lasts-2-minutes bug
- the metrics were always presented 2 minutes, regardless what values have been loaded from the config file
- now the values from the config file are reflected in the behavior
2020-02-28 23:35:36 +01:00
Paul Rogalinski-Pinter
e2c1e26d3e auth config for mqtt, fixed error handling 2020-02-03 13:34:20 +01:00
Christoph Petrausch
7d41c58d70 Initial commit 2018-03-18 13:20:49 +01:00