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

Abierto Apto para principiantes
#2,157 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
graphql, linux, typescript
Área
backend, devtools

Línea de trabajo

El filtro está en read() en api/src/unraid-api/graph/resolvers/metrics/temperature/sensors/lm_sensors.service.ts. Actualmente acepta cualquier clave que termine en _input y siempre establece CELSIUS. Empieza ahí y restringe las claves aceptadas a temp<n>_input con un valor numérico, dejando fuera ventiladores, voltajes y potencia. Está terminado cuando la consulta GraphQL para metrics.temperature.sensors devuelve solo las cuatro lecturas de temperatura de la reproducción, sin unit: CELSIUS en los valores de ventiladores o voltajes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
123
Forks
25
Merge medio
2 d 16 h
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de unraid/api

Todos los issues de unraid/api

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.