kallex / PromDapter

Prometheus CzAdapter
MIT License
107 stars 9 forks source link

Filtering in Pattern #3

Open 33Fraise33 opened 4 years ago

33Fraise33 commented 4 years ago

Hello,

First of all, thanks for this amazing product.

I've been playing around a bit with the configuration and reading through the other issues. I have created a custom entry like the ones in the previous issues. But I'd like to filter those further and I'm currently unsure how to do that.

I have the following config:

    # Fans
    - '(?<Entity_Fan>)(?<MetricName>Chassis)(?<FanNo>\d+)'
    - '(?<Entity_Fan>)(?<MetricName>CPU$)'
    # CPU Temp & Package Power
    - '(?<Entity>CPU) (?<MetricName>Package Power)'
    - '(?<Entity_CPU>)(?<MetricName>Core) (?<CoreNo>\d+$)'

And the following result:

# HELP hwi_cpu_core_c CPU Core °C - CPU [#0]: Intel Core i7-4790K: DTS
hwi_cpu_core_c{coreno="0",unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Core 0",source="CPU [#0]: Intel Core i7-4790K: DTS"} 48
hwi_cpu_core_c{coreno="1",unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Core 1",source="CPU [#0]: Intel Core i7-4790K: DTS"} 46
hwi_cpu_core_c{coreno="2",unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Core 2",source="CPU [#0]: Intel Core i7-4790K: DTS"} 44
hwi_cpu_core_c{coreno="3",unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="Core 3",source="CPU [#0]: Intel Core i7-4790K: DTS"} 44
# HELP hwi_cpu_package_power_w CPU Package Power W - CPU [#0]: Intel Core i7-4790K: Enhanced
hwi_cpu_package_power_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="CPU Package Power",source="CPU [#0]: Intel Core i7-4790K: Enhanced"} 36.836689608388234
# HELP hwi_fan_chassis_rpm Fan Chassis RPM - ASUS Z97M-PLUS (Nuvoton NCT6791D)
hwi_fan_chassis_rpm{fanno="1",unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="Chassis1",source="ASUS Z97M-PLUS (Nuvoton NCT6791D)"} 974
hwi_fan_chassis_rpm{fanno="2",unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="Chassis2",source="ASUS Z97M-PLUS (Nuvoton NCT6791D)"} 954
# HELP hwi_fan_cpu_c Fan CPU °C - ASUS Z97M-PLUS (Nuvoton NCT6791D)
hwi_fan_cpu_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="CPU",source="ASUS Z97M-PLUS (Nuvoton NCT6791D)"} 41
# HELP hwi_fan_cpu_rpm Fan CPU RPM - ASUS Z97M-PLUS (Nuvoton NCT6791D)
hwi_fan_cpu_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="CPU",source="ASUS Z97M-PLUS (Nuvoton NCT6791D)"} 1138

Included is the option: hwi_fan_cpu_c, I would like to filter sensors with the exact name 'CPU' and unit "RPM". Or maybe filtering on source as well would be nice. As 'CPU Package' temperature is included in ': DTS' & ': enhanced'

Is that possible? As I'd like to keep my prometheus instance as small as possible.

kallex commented 4 years ago

Right now that filtering is not possible. I've had it on my TODO list (for a good while now); with the ability to describe those filters in the yaml-config.

I try to come up with some feasible solution soon, including few other features that I think are worthwhile.

33Fraise33 commented 4 years ago

Thanks for replying and developing this! I had to trial and error a bit to get all the info in there that I want but I'm very happy with the result now ;)