prometheus / procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Apache License 2.0
756 stars 311 forks source link

Export mdstat parsing function #550

Closed SaimonWoidig closed 10 months ago

SaimonWoidig commented 1 year ago

Currently the parseMDStat function in file mdstat.go is unexported. It would be practical to export it. Perhaps someone wants to use only the mdstat file parsing functionality. This way, it wouldn't be needed to initialize the FS and read the mdstat from it. Instead, the mdstat file content would be passed instead.

discordianfish commented 11 months ago

Do you have a concrete use for this?

SaimonWoidig commented 11 months ago

Sorry for the late response, I was on a vacation. I am developing a Zabbix Agent2 plugin for monitoring MD RAID and I thought, I could use the mdstat parsing functionality from this package. For now, I just copied the file, did some changes to make it work (mainly rewrite errors). I made sure, that it's known that I took this part of code from the procfs module. I also used the same license.

discordianfish commented 11 months ago

Why don't you use MDStat() and only the parsing? Just trying to understand, in general I'm totally fine with exporting it. @SuperQ wdyt?

dswarbrick commented 11 months ago

AFAIU, the general consensus is to move away from the regex-based parsing of /proc/mdstat in mdstat.go, and use the sysfs-based parser in sysfs/mdraid.go.

SaimonWoidig commented 11 months ago

Oh my god, I don't even know, how I missed that MDRaid functionality in mdraid.go. Thanks, I will look and try it out, and I honestly think, that it's a better way to go. Sorry for your wasted time. 🤦😔

discordianfish commented 10 months ago

Ok then let's close this for now!