Expose ZFS ARC size and maximum as optional read-only metrics

Abierto
#2,119 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
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
graphql, typescript
Área
api, backend

Línea de trabajo

Start by locating the public GraphQL schema and the API code that collects MemoryUtilization; the issue does not name specific files or tests. Trace how existing memory metrics are read and exposed, then check the schema and tests for the relevant entry points. Done means optional, read-only ARC size and maximum fields report byte values or null when unavailable, with tests for the listed cases and existing memory behavior preserved.

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

Descripción

Is your feature request related to a problem?

Home Assistant users need ZFS ARC used bytes and percentage of the configured ARC maximum to replace a separate Glances installation. The standard Unraid API does not currently expose these values, so a typed client cannot provide them without bypassing the API.

This blocks the two ZFS-cache metrics in https://github.com/tinkerologie/ha-unraid/issues/202. The integration intentionally performs all Unraid I/O through the unraid-api Python client.

Describe the solution you'd like

Expose optional, read-only ARC size and ARC maximum values in the public metrics schema, for example nullable BigInt fields on MemoryUtilization (field names subject to maintainer preference). Read the current size and c_max counters from the fixed /proc/spl/kstat/zfs/arcstats source, without SMART calls, disk probes, shell execution, or disk wake-ups. Return null when ZFS/ARC stats are unavailable; do not substitute zero for unavailable data. Define both values in bytes, allowing clients to calculate size / c_max * 100.

Acceptance criteria:

  • Public GraphQL schema exposes typed ARC size and maximum fields, with documented units and unavailable behavior.
  • Collection remains read-only and does not spin up disks.
  • Tests cover valid counters, unavailable ZFS, malformed/missing counters, and large values.
  • Existing memory metrics retain their current behavior.

Describe alternatives you've considered

Glances, SSH collection, and the separate Unraid Management Agent can expose ARC data, but they introduce another service or bypass the standard Unraid API. HA template/group helpers cannot reconstruct ARC size or c_max from total/used/free/available memory. We do not want to manufacture an estimate or query undocumented file/log endpoints.

Additional context

Verified against live API 4.37.7+250d3663: the type list has no ARC/ZFS metrics type, and MemoryUtilization contains total, used, free, available, active, buffcache and swap metrics only. The published schema at https://github.com/unraid/api/blob/250d366375f3f004e4c02e9db1aede5a7a629705/api/generated-schema.graphql#L1808 confirms this. The Python client currently has no typed ARC fields either.

Once the server schema provides the capability, the Python client can detect it and expose optional fields without breaking older servers. The HA integration can then create ZFS cache sensors only for supported servers.

Environment (if relevant)

Unraid OS Version: 7.3.4; API 4.37.7+250d3663. The original request was raised on Unraid 7.2.4.

Pre-submission Checklist

  • I have searched existing issues to ensure this feature hasn't already been requested
  • This is not an Unraid Connect related feature
  • I have provided clear examples or use cases for the feature
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.