Skip to content

fix(zfs): use a live iostat sample instead of a since-boot average - #640

Merged
VVelox merged 1 commit into
librenms:masterfrom
ahoogerhuis:bugs/zfs-iostat-live-sample
Oct 12, 2026
Merged

VVelox merged 1 commit into
librenms:masterfrom
ahoogerhuis:bugs/zfs-iostat-live-sample

Conversation

@ahoogerhuis

Copy link
Copy Markdown
Contributor

zpool iostat without -y/interval reports a since-boot average, not current activity - stale scrub_wait/trim_wait long after activity stops. Changed to -y -l -q -p -H <pool> 2 1 for a live sample.

Already running in our production fleet. Developed with Claude's assistance; reviewed, I take responsibility for correctness.

@ahoogerhuis
ahoogerhuis marked this pull request as ready for review September 26, 2026 16:18
Comment thread snmp/zfs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This totally kills the ability to use it as a extend as it will result in a timeout. Docs need updated to reflect the output of this needs update to dump the results to a file and read via /bin/cat /var/cache/zfs.extend.

zpool iostat with no interval returns a since-boot average, not a live
reading. Sampling a real interval costs about two seconds per pool, which
is too slow to run directly as an extend, so -w writes the output to a
file for SNMPD to cat and -q silences stdout for cron.

Made with help from Claude
@ahoogerhuis
ahoogerhuis force-pushed the bugs/zfs-iostat-live-sample branch from 3099ecf to bfd8600 Compare October 12, 2026 06:38
@ahoogerhuis

Copy link
Copy Markdown
Contributor Author

@VVelox
Measured it on three pools: 2.00s per pool, linear — 2.1s for one, 6.2s for
three. Can't run inline, as you say.

Added -w, -q and -o defaulting to /var/cache/zfs.extend, written atomically.
The POD now documents the cat form and a cron line in place of the direct
extend. I used the flat path you named rather than a directory with snmp and
json inside as syslog-ng does — say if you'd rather have the latter

@VVelox
VVelox merged commit 46ec5fe into librenms:master Oct 12, 2026
3 checks passed
@VVelox

VVelox commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants