mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-28 23:19:46 -08:00
Update mdstat fixture based on linux source.
Update `Contains` matching for `resync=`
This commit is contained in:
parent
64b82596ef
commit
afac1f7433
|
@ -25,13 +25,13 @@ md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1]
|
|||
|
||||
md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0]
|
||||
523968 blocks super 1.2 [4/4] [UUUU]
|
||||
resync=DELAYED
|
||||
resync=DELAYED
|
||||
|
||||
md10 : active raid0 sda1[0] sdb1[1]
|
||||
314159265 blocks 64k chunks
|
||||
|
||||
md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1]
|
||||
4190208 blocks super 1.2 [2/2] [UU]
|
||||
resync=PENDING
|
||||
resync=PENDING
|
||||
|
||||
unused devices: <none>
|
||||
|
|
|
@ -190,7 +190,9 @@ func parseMdstat(mdStatusFilePath string) ([]mdStatus, error) {
|
|||
|
||||
// If device is syncing at the moment, get the number of currently synced bytes,
|
||||
// otherwise that number equals the size of the device.
|
||||
if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") && !strings.Contains(lines[j], "resync=DELAYED") && !strings.Contains(lines[j], "resync=PENDING") {
|
||||
if strings.Contains(lines[j], "recovery") ||
|
||||
strings.Contains(lines[j], "resync") &&
|
||||
!strings.Contains(lines[j], "\tresync=") {
|
||||
syncedBlocks, err = evalBuildline(lines[j])
|
||||
if err != nil {
|
||||
return mdStates, fmt.Errorf("error parsing mdstat: %s", err)
|
||||
|
|
Loading…
Reference in a new issue