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

未关闭 适合新手
#2,157 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
graphql, linux, typescript
领域
backend, devtools

调研方向

过滤逻辑位于 api/src/unraid-api/graph/resolvers/metrics/temperature/sensors/lm_sensors.service.ts 中的 read()。目前它接受任何以 _input 结尾的键,并且总是设置 CELSIUS。从这里开始,将接受的键限制为带数值的 temp<n>_input,排除风扇、电压和功率。完成标准是:metrics.temperature.sensors 的 GraphQL 查询只返回复现中的四个温度读数,风扇或电压值上不再带有 unit: CELSIUS。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
123
派生
25
平均合并
2 天 16 小时
30 天内合并 PR
9

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

unraid/api 的其他 Issue

查看 unraid/api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。