nvme-telem 0.3.1

NVMe S.M.A.R.T. / telemetry collection for Linux
docs.rs failed to build nvme-telem-0.3.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

nvme-telem

crates.io docs.rs license

A Rust library for collecting NVMe telemetry and S.M.A.R.T. data on Linux.

Features

  • Read NVMe SMART/Health logs
  • Extract detailed controller identification data
  • Organized structs for different metric categories (Identity, Capacity, Thermals, etc.)

Installation

cargo add nvme-telem

Quick start example

use nvme_telem::nvme;

fn main() {
    for ctrl in nvme::list_nvme_controllers() {
        let dev = format!("/dev/{}", ctrl);
        match nvme::get_smart_log(&dev) {
            Ok(smart) => println!(
                "{} (S/N {}): {} K, {} power-on hours, critical warning {:#x}",
                smart.nvme_name,
                smart.serial_number,
                smart.temperature,
                smart.power_on_hours,
                smart.critical_warning,
            ),
            Err(e) => eprintln!("{}: {} (root access required?)", ctrl, e),
        }
    }
}

Programs using this library need root privileges at runtime to access /dev/nvme* devices — build as a normal user, run the binary with sudo.

Requirements

Runtime

  • Linux
  • One or more NVMe storage devices
  • Root/sudo privileges (for /dev/nvme* access)

Build

  • Rust 1.91.0+ (see rust-toolchain.toml)
  • libclang, for generating the NVMe ioctl bindings:
# Ubuntu / Debian
sudo apt install clang libclang-dev llvm-dev

# Rocky Linux / RHEL / Fedora
sudo dnf install clang-devel llvm-devel

Running the example

cargo build --example sanity_check
sudo ./target/debug/examples/sanity_check

(Build as your normal user, not under sudo, running cargo as root leaves root-owned files in target/ and may not find your toolchain.)

Safety

This library uses unsafe code to make ioctl calls to NVMe devices. All unsafe code is isolated in the device access functions.

Contributing

Contributions welcome — see CONTRIBUTING.md. MRs target the rc branch and include a small change file; the rest is automated.

License

MIT — see LICENSE.