Documentation
¶
Overview ¶
Package zfs provides functions to read ZFS statistics.
Package zfs provides functions to read ZFS statistics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoZfs = errors.New("zfs utilities unavailable")
ErrNoZfs is returned when the ZFS utilities or kernel interfaces are unavailable.
Functions ¶
Types ¶
type PoolIoStats ¶ added in v0.19.0
PoolIoStats holds calculated per-second I/O rates for a pool.
type PoolKernelStat ¶ added in v0.19.0
PoolKernelStat is the inexpensive pool telemetry exposed by the ZFS kernel. NRead and NWrite are cumulative byte counters since the pool was imported.
func PoolKernelStats ¶ added in v0.19.0
func PoolKernelStats() ([]PoolKernelStat, error)
PoolKernelStats reads pool state and cumulative I/O counters directly from procfs. These kstats are the same interfaces used by node_exporter's Linux ZFS collector and avoid keeping a `zpool iostat` subprocess alive.
type PoolStat ¶ added in v0.19.0
type PoolStat struct {
DisplayName string // optional friendly name; Name remains the stable key
MountID string // Btrfs filesystem identity, empty for other backends
IODevice string // sole Btrfs member device, if known
Raw bool // physical accounting rather than usable filesystem space
Name string
Size uint64 // total capacity in bytes
Alloc uint64 // allocated bytes
Free uint64 // free bytes
Health string // ONLINE, DEGRADED, FAULTED, ...
}
PoolStat is a snapshot of a ZFS pool's capacity and health.
type PoolStatus ¶ added in v0.19.0
type PoolStatus struct {
Name string
State string // ONLINE, DEGRADED, FAULTED, ...
Status string // status: advisory message, when the pool carries one
Scrub ScrubStatus
Vdevs []VdevStatus
}
PoolStatus holds parsed `zpool status` information for one pool.
func PoolStatuses ¶ added in v0.19.0
func PoolStatuses() ([]PoolStatus, error)
PoolStatuses runs `zpool status` and parses per-pool state, scrub, and vdev information. The human-readable format has been stable across OpenZFS releases; rows are matched by their tabular shape rather than position.
type ScrubStatus ¶ added in v0.19.0
type ScrubStatus struct {
State string // NONE, SCANNING, FINISHED, CANCELED
Progress string // e.g. "10.00%" while scanning
Errors uint64
}
ScrubStatus holds the scrub (or resilver) status parsed from the scan line.