Implement mdraid sysfs parsing#509
Merged
SuperQ merged 1 commit intoprometheus:masterfrom May 5, 2023
Merged
Conversation
Modernised method of fetching mdraid statistics via machine-readable sysfs entries, instead of parsing human-readable /proc/mdstat. Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Member
|
Nice, do we know how far back this kernel support goes? |
Contributor
Author
The mdraid sysfs stuff is pretty mature - it should go back as far as 2.6.x (yeah, for all those Synology NAS users...) 2.6.12 looks to contain the earliest documentation of mdraid sysfs interface: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/md.txt?h=v2.6.12, ca. April 2005. |
discordianfish
approved these changes
Apr 26, 2023
Member
discordianfish
left a comment
There was a problem hiding this comment.
Nice! LGMT. We can still support parsing both in the node-exporter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modernised method of fetching mdraid statistics via machine-readable sysfs entries, instead of parsing human-readable
/proc/mdstat.This would go a long way towards addressing prometheus/node_exporter#1085, as well as superseding / obsoleting various other pending PRs (#329) that attempt to squeeze a bit more info out of
/proc/mdstatand issues, e.g., prometheus/node_exporter#1874The mdraid sysfs entries contain significantly more detailed information that what is presented in the simplified and human-readable
/proc/mdstat.I'd like to get a few more eyeballs on this code, and have it alongside the existing /proc/mdstat parser initially, with a view to perhaps making the
MDStatfunction a wrapper around the new sysfs parser eventually (or refactor node_exporter to use the new function directly). ExistingMDStatmembers ActivityState, DisksDown, DisksFailed, DisksSpare, DisksTotal, DisksActive can be derived / counted / calculated from information exposed by the newMdraidstruct.Some of the
MDStatstruct information is not exposed directly by/sys/block/md*/md, however it is obtainable via other means. For example:/sys/block/*/size(measured in 512-byte sectors - yes, even on 4K sector drives).Other
MDStatstruct members which are not currently used by node_exporter:rate()function.@SuperQ I would greatly appreciate your review / input on this.