Skip to content

nvme-cli: add nvme top command for real-time monitoring

Nilay Shroff linux-nvme 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 1 replyApplied
  2. v27 patches 0 repliesSuperseded
  3. v17 patches 7 repliesSuperseded

Changes in v3 from the cover letter

- Addressed few more review comments from AI chatbot:

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/7nvme: add support for unsigned and long types in table_get_value_width()util/table.c+9 -00 replies
2/7nvme: use table_get_value_width() in table_print_centered()util/table.c+4 -220 replies
3/7nvme: add support for float and double types in table_print_XXX()util/table.c util/table.h+46 -20 replies
4/7nvme: allow table output to be directed to a FILE streamutil/table.c util/table.h+44 -330 replies
5/7nvme: add sigaction for SIGWINCHutil/sighdl.c util/sighdl.h+27 -30 replies
6/7nvme: add generic top-like dashboard frameworkutil/dashboard.c util/dashboard.h util/meson.build+962 -10 replies
7/7nvme: add nvme top commandmeson.build nvme-builtin.h nvme-print-stdout-top.c +5 more+1636 -230 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCHv3 0/7] nvme-cli: add nvme top command for real-time monitoring

Hi,

Monitoring NVMe devices and paths in production is currently limited to static snapshots via nvme-cli. While this is sufficient for basic inspection, it is not ideal for NVMe-oF (fabrics) deployments where path conditions can change dynamically due to varying network latency, congestion, or link failures.

In multipath environments, administrators often need continuous visibility into path state, ANA status, queue depth, link speed, and error counters. Today, this typically requires repeatedly invoking commands or relying on ad-hoc tooling, making it harder to quickly identify issues.

This patch series introduces "nvme top", a tool for real-time monitoring of NVMe devices and fabrics paths, similar in spirit to tools such as top or iotop. The goal is to provide a continuously updating view of device and path health, enabling faster detection of link degradation, multipath imbalances, and transient failures.

The series first adds the necessary building blocks for supporting a top-like dashboard. The initial patches extend the table APIs (including support for additional data types such as unsigned, long, float, and double) and introduce a generic dashboard framework. The final patch adds the nvme top command built on top of this framework.

Future work:
- Export NVMe statistics to external monitoring systems (e.g. Grafana).
- Improve topology change detection in multipath configurations. The current implementation relies on kobject uevents for topology change, but namespace path add/delete events are not exported by the kernel since they are associated with hidden gendisk kobjects. This may require explicit uevent generation from the NVMe driver for namespace path changes.
- Wire nvme top into an MCP pipeline and feed it to an LLM

As usual feedback, comments, and suggestions are welcome!

Changes since v2:
- Addressed few more review comments from AI chatbot:

    https://github.com/linux-nvme/nvme-cli/pull/3350

- Separate the nvme top code under new file named nvme-print-stdout-top.c (Daniel Wagner)
- Ensure that user could terminate nvme top using Ctrl+C
(Sagi Grimberg)
Link to v2: https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Addressed review comments from AI chatbot Copilot:

    https://github.com/linux-nvme/nvme-cli/pull/3333

Link to v1: https://lore.kernel.org/all/[email protected]/

Nilay Shroff (7):
nvme: add support for unsigned and long types in
table_get_value_width()
nvme: use table_get_value_width() in table_print_centered()
nvme: add support for float and double types in table_print_XXX()
nvme: allow table output to be directed to a FILE stream
nvme: add sigaction for SIGWINCH
nvme: add generic top-like dashboard framework
nvme: add nvme top command

 meson.build             |    1 +
 nvme-builtin.h          |    1 +
 nvme-print-stdout-top.c | 1553 +++++++++++++++++++++++++++++++++++++++
 nvme-print-stdout.c     |   24 +-
 nvme-print.c            |    5 +
 nvme-print.h            |    7 +-
 nvme.c                  |   45 ++
 nvme.h                  |   23 +
 util/dashboard.c        |  905 +++++++++++++++++++++++
 util/dashboard.h        |   55 ++
 util/meson.build        |    3 +-
 util/sighdl.c           |   25 +-
 util/sighdl.h           |    5 +-
 util/table.c            |  124 ++--
 util/table.h            |   28 +
 15 files changed, 2724 insertions(+), 80 deletions(-)
 create mode 100644 nvme-print-stdout-top.c
 create mode 100644 util/dashboard.c
 create mode 100644 util/dashboard.h
Signature · 1 line
2.53.0