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

オープン
#2,119 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
graphql, typescript
領域
api, backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
123
フォーク
25
平均マージ
2日 16時間
マージ済み PR(30日)
9

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

unraid/api のほかの issue

unraid/api の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。