Skip to content

fix(zfs): guard ARC efficiency percentages against a zero denominator - #641

Merged
bennetgallein merged 1 commit into
librenms:masterfrom
ahoogerhuis:bugs/zfs-arc-zero-guard
Oct 5, 2026
Merged

bennetgallein merged 1 commit into
librenms:masterfrom
ahoogerhuis:bugs/zfs-arc-zero-guard

Conversation

@ahoogerhuis

Copy link
Copy Markdown
Contributor

snmp/zfs divides by arc_hits/arc_misses with no zero-guard - crashes on any host with zero hits or misses since last poll (e.g. right after boot). Guarded all three denominators, including a wrong-variable guard on anon_hits_percent.

Verified on a test box, not yet in production.

Developed with Claude's assistance; reviewed, I take responsibility for correctness.

The script died with 'Illegal division by zero' when arcstats reported
zero hits, misses or accesses, as on a cold or idle ARC, so no JSON was
returned. anon_hits_percent guarded on its numerator instead of its
divisor.

Made with help from Claude
@ahoogerhuis
ahoogerhuis marked this pull request as ready for review September 26, 2026 16:18
@bennetgallein
bennetgallein merged commit 1974484 into librenms:master Oct 5, 2026
3 checks passed
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