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
Add include and exclude filter for sensors in hwmon collector (prometheus#3072)
* Add include and exclude filter for sensors in hwmon collector
Fixesprometheus#2242
This commit adds two new flags (`collector.hwmon.sensor-include` and `collector.hwmon.sensor-exclude`) to the `hwmon` collector to allow inclusion or exclusion of specific sensors.
Some devices export nonsensical values for certain sensors. Here is an example:
```
node_hwmon_temp_celsius{chip="platform_nct6775_656",sensor="temp13"} 49.75
node_hwmon_temp_celsius{chip="platform_nct6775_656",sensor="temp15"} 3.892313987e+06
node_hwmon_temp_celsius{chip="platform_nct6775_656",sensor="temp16"} 3.892313987e+06
```
As a user I would like to only exclude these sensors, not necessarily the complete device (as is currently possible with the `--collector.hwmon.chip-exclude` flag) as other sensor values might be sensical or desired.
The new option filters based both on device name and sensor name, separated by a semicolon. For example, to exclude the two sensors above, the following regex can be used:
~~~
--collector.hwmon.sensor-exclude="platform_nct6775_656;temp1[5,6]"
~~~
---------
Signed-off-by: Simon Krenger <[email protected]>
Signed-off-by: Vitaly Zhuravlev <[email protected]>
Copy file name to clipboardExpand all lines: collector/hwmon_linux.go
+15-2Lines changed: 15 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,10 @@ import (
32
32
)
33
33
34
34
var (
35
-
collectorHWmonChipInclude=kingpin.Flag("collector.hwmon.chip-include", "Regexp of hwmon chip to include (mutually exclusive to device-exclude).").String()
36
-
collectorHWmonChipExclude=kingpin.Flag("collector.hwmon.chip-exclude", "Regexp of hwmon chip to exclude (mutually exclusive to device-include).").String()
35
+
collectorHWmonChipInclude=kingpin.Flag("collector.hwmon.chip-include", "Regexp of hwmon chip to include (mutually exclusive to device-exclude).").String()
36
+
collectorHWmonChipExclude=kingpin.Flag("collector.hwmon.chip-exclude", "Regexp of hwmon chip to exclude (mutually exclusive to device-include).").String()
37
+
collectorHWmonSensorInclude=kingpin.Flag("collector.hwmon.sensor-include", "Regexp of hwmon sensor to include (mutually exclusive to sensor-exclude).").String()
38
+
collectorHWmonSensorExclude=kingpin.Flag("collector.hwmon.sensor-exclude", "Regexp of hwmon sensor to exclude (mutually exclusive to sensor-include).").String()
0 commit comments