kallex / PromDapter

Prometheus CzAdapter
MIT License
106 stars 9 forks source link

How can I get fan speed #2

Closed LarkinZero closed 4 years ago

LarkinZero commented 4 years ago

The CPU\System 1\System 2 fan speed is not shown on PromDapter. Can it be achieved by modifying the Prometheusmapping.yaml file? Snipaste_2020-08-08_15-07-10

kallex commented 4 years ago

Yes. There's simple notation where you can describe the entity it relates to and also extract/parse out the number so that it can be used in grouped ups/averages or distinguished.

The Fans are bit problematic with the current customization of .yaml syntax, as it doesn't allow giving MetricName a fixed, and there is no "Fan" word in the actual name, which MetricName could catch.

That being said, I try to make example below with simple and then the better, where there are two variants of either using MetricName or MetricCategory. Try the various ones out to see which one you prefer as the output.

Simplest way to get them showin is to match the name as-is (I'll entity-bind them to Fan in the example, but then it will appear your Prometheus side just as "System 1" and "System 2"

- '(?<Entity_Fan>)(?<MetricName>System 1|System 2)'

Better approach is to separate different parts, so that you have Fan entity with Metric System; I don't personally like how we make the MetricName "System" here as its not proper, so check the 3rd below too

- '(?<Entity_Fan>)(?<MetricName>System) (?<FanNo>\d+)'

... this 3rd example is attempting to leave the MetricName out and replace it with MetricCategory, as the unit being "RPM" should qualify enough in the end result

- '(?<Entity_Fan>)(?<MetricCategory>System) (?<FanNo>\d+)'

You can start with the simplest one and verify that you can get the sensor visible in the output, and then move onwards to more complex ones (as the .yaml is quite sensitive on indenting, its better to check out that you modify right file and get the cache resetted properly).

LarkinZero commented 4 years ago

- '(?<Entity_Fan>)(?<MetricName>System 1|System 2|CPU)' works for me! Thank you, you’re amazing! Snipaste_2020-08-08_18-08-49

JavaMachine commented 4 years ago

Hello, @LarkinZero @kallex

I added following to my .yaml file

# Fan
    - '(?<Entity_Fan>)(?<MetricName>System 1|System 2|System 3/PCH|System 4|System 5 Pump|CPU)'
# Chipset
    - '(?<Entity_Chipset>) (?<MetricName>Chipset) \((?<MetricCategory>[^)]+)\)'

To get my chipset temp and all fans RPM. Then I restarted Prometheus Adapter and refreshed http://localhost:10445/metrics.

I guess I did something wrong, I could not get metrics. How can I do it properly?

Thanks in advance

kallex commented 4 years ago

First to check (because completely my fault of causing the confusion):

Did you edit the file under C:\ProgramData\PromDapter and not under C:\Program Files\PromDapter?

JavaMachine commented 4 years ago

First to check (because completely my fault of causing the confusion):

Did you edit the file under C:\ProgramData\PromDapter and not under C:\Program Files\PromDapter?

I was editing yaml from C:\Program Files\PromDapter. Thanks now it worked.

But, now hwi_cpu_tdie_c and hwi_cpu_tctltdie_c metrics dissapeared.

I suspect they are now appearing with new name:

# HELP hwi_fan_cpu_a Fan CPU A - CPU [#0]: AMD Ryzen 7 3700X: Enhanced
hwi_fan_cpu_a{unit="A",sensor_type="SENSOR_TYPE_CURRENT",sensor="CPU EDC",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 34.387241207272744
hwi_fan_cpu_a{unit="A",sensor_type="SENSOR_TYPE_CURRENT",sensor="CPU TDC",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 18.171628952026367
# HELP hwi_fan_cpu_c Fan CPU °C - CPU [#0]: AMD Ryzen 7 3700X: Enhanced
hwi_fan_cpu_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="CPU (Tctl/Tdie)",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 46
hwi_fan_cpu_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="CPU CCD1 (Tdie)",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 41
hwi_fan_cpu_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="CPU Die (average)",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 47.74452209472656
# HELP hwi_fan_cpu_c Fan CPU °C - GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)
hwi_fan_cpu_c{unit="°C",sensor_type="SENSOR_TYPE_TEMP",sensor="CPU",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 46
# HELP hwi_fan_cpu_rpm Fan CPU RPM - GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)
hwi_fan_cpu_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="CPU",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 2115
# HELP hwi_fan_cpu_v Fan CPU V - CPU [#0]: AMD Ryzen 7 3700X: Enhanced
hwi_fan_cpu_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="CPU Core VID (Effective)",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 1.1
hwi_fan_cpu_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="CPU Core Voltage (SVI2 TFN)",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 1.2999999999999998
# HELP hwi_fan_cpu_v Fan CPU V - GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)
hwi_fan_cpu_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="CPU VCORE SOC",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 1.08
hwi_fan_cpu_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="CPU VDDP",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 0.912
# HELP hwi_fan_cpu_v Fan CPU V - GIGABYTE X570 AORUS PRO WIFI (ITE IT8792E)
hwi_fan_cpu_v{unit="V",sensor_type="SENSOR_TYPE_VOLT",sensor="CPU VDD18",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8792E)"} 1.815
# HELP hwi_fan_cpu_w Fan CPU W - CPU [#0]: AMD Ryzen 7 3700X: Enhanced
hwi_fan_cpu_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="CPU Core Power",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 23.555110931396484
hwi_fan_cpu_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="CPU Package Power (SMU)",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 44.86765107445795
hwi_fan_cpu_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="CPU PPT",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 44.99626541137695
hwi_fan_cpu_w{unit="W",sensor_type="SENSOR_TYPE_POWER",sensor="CPU SoC Power",source="CPU [#0]: AMD Ryzen 7 3700X: Enhanced"} 11.365717887878418
# HELP hwi_fan_system_1_rpm Fan System 1 RPM - GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)
hwi_fan_system_1_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="System 1",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 1610
# HELP hwi_fan_system_2_rpm Fan System 2 RPM - GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)
hwi_fan_system_2_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="System 2",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 1113
# HELP hwi_fan_system_3pch_rpm Fan System 3/PCH RPM - GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)
hwi_fan_system_3pch_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="System 3/PCH",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8688E)"} 1674
# HELP hwi_fan_system_4_rpm Fan System 4 RPM - GIGABYTE X570 AORUS PRO WIFI (ITE IT8792E)
hwi_fan_system_4_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="System 4",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8792E)"} 1128
# HELP hwi_fan_system_5_pump_rpm Fan System 5 Pump RPM - GIGABYTE X570 AORUS PRO WIFI (ITE IT8792E)
hwi_fan_system_5_pump_rpm{unit="RPM",sensor_type="SENSOR_TYPE_NONE",sensor="System 5 Pump",source="GIGABYTE X570 AORUS PRO WIFI (ITE IT8792E)"} 1106
kallex commented 4 years ago

Double check that HWiNFO is still showing them and the sensors didn't get disabled there too.

Also about your Chipset metrics; remove the between EntityChipset and the Chipset part; as the Entity notation expects to be just hard-definition and the actual metric will start immediately:

- '(?<Entity_Chipset>)(?<MetricName>Chipset)
kallex commented 4 years ago

Ahh true on that, your last part "CPU" gathers them all. So you need to put that "too inclusive" regexp on the very bottom (or later than any of those more specific ones).

JavaMachine commented 4 years ago

@kallex Thanks a lot, you did awesome work.

Here, how it looks

image

yaml file (in case someone needs it)

Prometheusmapping.txt

kallex commented 4 years ago

Thank you for sharing the changes! I am (slowly) adding WMI support and more Yaml-level options in the future, I also have Corsair i-series PSU monitoring regexps (use them myself)... and some other provided changes.

I try to merge all community-made additions in and build some kind of "dynamic sharing" service perhaps in the future.

Btw that looks really nice!

JavaMachine commented 4 years ago

Thanks @kallex,

I have one more problem. In my HWiNFO I have two temperature sensors

DIMM[2] Temperature
DIMM[3] Temperature

I have tried adding following to my yaml:

# DIMM
    - '(?<Entity_DIMM>)(?<MetricName>\[(?<DIMMNo>\d+)\] Temperature)'

I am not expert in regular expressions :( I do not know why it is not working

kallex commented 4 years ago

You have small issue, as you use the "Entity_" notation when you actually have the entity name "DIMM" in the actual name. So small change like this fixes it:

- '(?<Entity>DIMM)(?<MetricName>\[(?<DIMMNo>\d+)\] Temperature)'

For future testing you can use following handy tool (it's using the .NET syntax which is what we need here): http://regexstorm.net/tester