Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)

Đang mở Phù hợp với người mới
#2,157 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
graphql, linux, typescript
Lĩnh vực
backend, devtools

Hướng nghiên cứu

Bộ lọc nằm trong read() tại api/src/unraid-api/graph/resolvers/metrics/temperature/sensors/lm_sensors.service.ts. Hiện tại nó chấp nhận mọi khóa kết thúc bằng _input và luôn đặt CELSIUS. Hãy bắt đầu từ đó và giới hạn các khóa được chấp nhận thành temp<n>_input có giá trị số, loại trừ quạt, điện áp và công suất. Hoàn thành khi truy vấn GraphQL cho metrics.temperature.sensors chỉ trả về bốn số đo nhiệt độ từ bước tái hiện, không còn unit: CELSIUS trên giá trị quạt hoặc điện áp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Environment

Unraid OS Version: 7.4.0 (Unraid API 4.37.12)

Are you using a reverse proxy? No, direct access (http://:5000)

Pre-submission Checklist

  • I have verified that my Unraid OS is up to date
  • I have tested this issue by accessing my server directly (not through a reverse proxy)
  • This is not an Unraid Connect related issue

Issue Description

metrics.temperature.sensors contains every value of sensors -j that ends with _input, not only temperatures. Voltages (in*_input), fan speeds (fan*_input) and power (power*_input) are returned as temperature sensors with unit: CELSIUS and type: CUSTOM.

Cause: LmSensorsService.read() in api/src/unraid-api/graph/resolvers/metrics/temperature/sensors/lm_sensors.service.ts only checks key.endsWith('_input') and always sets TemperatureUnit.CELSIUS.

Steps to Reproduce

  1. Server with a Super-I/O chip that exposes voltages and fans via lm-sensors (here: Fintek f71868a, plus fam15h_power)
  2. Query { metrics { temperature { sensors { id name type current { value unit } } } } }
  3. Look at the returned sensors

Expected Behavior

Only temperature readings (temp*_input) are returned as temperature sensors.

Actual Behavior

16 sensors are returned, only 4 of them are temperatures. Examples:

id (key part) value real meaning
f71868a-isa-0e80:3VSB:in7_input 3.3 voltage (V)
f71868a-isa-0e80:Array Fan:fan2_input 1570 fan (RPM)
fam15h_power-pci-00c4:power1:power1_input 106.96 power (W)
f71868a-isa-0e80:MB Temp:temp1_input 45 temperature (correct)

All of them come with unit: CELSIUS, so clients show e.g. "1570 °C" for a fan. Status/thresholds based on these values are meaningless as well.

Additional Context

Possible fix: in read(), only accept keys matching /^temp\d+_input$/ (lm-sensors naming), e.g.

if (!/^temp\d+_input$/.test(key) || typeof value !== 'number') continue;

Fans/voltages could be exposed separately later (see #1560 / #1598), but they should not appear in the temperature metrics.

Noticed while working on the ioBroker Unraid adapter (https://github.com/ingel81/ioBroker.unraid), which now filters these readings on its side.

Ngôn ngữ chính
TypeScript
Star
123
Fork
25
Merge trung bình
2 ngày 16 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của unraid/api

Tất cả issue của unraid/api

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.