Merge pull request #309 from prometheus/superq/mdstat
Fix mdadm collector for resync=PENDING.
This commit is contained in:
commit
f5a15ee404
|
@ -500,6 +500,7 @@ node_load5 0.37
|
||||||
# TYPE node_md_blocks gauge
|
# TYPE node_md_blocks gauge
|
||||||
node_md_blocks{device="md0"} 248896
|
node_md_blocks{device="md0"} 248896
|
||||||
node_md_blocks{device="md10"} 3.14159265e+08
|
node_md_blocks{device="md10"} 3.14159265e+08
|
||||||
|
node_md_blocks{device="md11"} 4.190208e+06
|
||||||
node_md_blocks{device="md127"} 3.12319552e+08
|
node_md_blocks{device="md127"} 3.12319552e+08
|
||||||
node_md_blocks{device="md3"} 5.853468288e+09
|
node_md_blocks{device="md3"} 5.853468288e+09
|
||||||
node_md_blocks{device="md4"} 4.883648e+06
|
node_md_blocks{device="md4"} 4.883648e+06
|
||||||
|
@ -511,6 +512,7 @@ node_md_blocks{device="md9"} 523968
|
||||||
# TYPE node_md_blocks_synced gauge
|
# TYPE node_md_blocks_synced gauge
|
||||||
node_md_blocks_synced{device="md0"} 248896
|
node_md_blocks_synced{device="md0"} 248896
|
||||||
node_md_blocks_synced{device="md10"} 3.14159265e+08
|
node_md_blocks_synced{device="md10"} 3.14159265e+08
|
||||||
|
node_md_blocks_synced{device="md11"} 4.190208e+06
|
||||||
node_md_blocks_synced{device="md127"} 3.12319552e+08
|
node_md_blocks_synced{device="md127"} 3.12319552e+08
|
||||||
node_md_blocks_synced{device="md3"} 5.853468288e+09
|
node_md_blocks_synced{device="md3"} 5.853468288e+09
|
||||||
node_md_blocks_synced{device="md4"} 4.883648e+06
|
node_md_blocks_synced{device="md4"} 4.883648e+06
|
||||||
|
@ -522,6 +524,7 @@ node_md_blocks_synced{device="md9"} 523968
|
||||||
# TYPE node_md_disks gauge
|
# TYPE node_md_disks gauge
|
||||||
node_md_disks{device="md0"} 2
|
node_md_disks{device="md0"} 2
|
||||||
node_md_disks{device="md10"} 2
|
node_md_disks{device="md10"} 2
|
||||||
|
node_md_disks{device="md11"} 2
|
||||||
node_md_disks{device="md127"} 2
|
node_md_disks{device="md127"} 2
|
||||||
node_md_disks{device="md3"} 8
|
node_md_disks{device="md3"} 8
|
||||||
node_md_disks{device="md4"} 2
|
node_md_disks{device="md4"} 2
|
||||||
|
@ -533,6 +536,7 @@ node_md_disks{device="md9"} 4
|
||||||
# TYPE node_md_disks_active gauge
|
# TYPE node_md_disks_active gauge
|
||||||
node_md_disks_active{device="md0"} 2
|
node_md_disks_active{device="md0"} 2
|
||||||
node_md_disks_active{device="md10"} 2
|
node_md_disks_active{device="md10"} 2
|
||||||
|
node_md_disks_active{device="md11"} 2
|
||||||
node_md_disks_active{device="md127"} 2
|
node_md_disks_active{device="md127"} 2
|
||||||
node_md_disks_active{device="md3"} 8
|
node_md_disks_active{device="md3"} 8
|
||||||
node_md_disks_active{device="md4"} 2
|
node_md_disks_active{device="md4"} 2
|
||||||
|
@ -544,6 +548,7 @@ node_md_disks_active{device="md9"} 4
|
||||||
# TYPE node_md_is_active gauge
|
# TYPE node_md_is_active gauge
|
||||||
node_md_is_active{device="md0"} 1
|
node_md_is_active{device="md0"} 1
|
||||||
node_md_is_active{device="md10"} 1
|
node_md_is_active{device="md10"} 1
|
||||||
|
node_md_is_active{device="md11"} 1
|
||||||
node_md_is_active{device="md127"} 1
|
node_md_is_active{device="md127"} 1
|
||||||
node_md_is_active{device="md3"} 1
|
node_md_is_active{device="md3"} 1
|
||||||
node_md_is_active{device="md4"} 0
|
node_md_is_active{device="md4"} 0
|
||||||
|
|
|
@ -25,9 +25,13 @@ md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1]
|
||||||
|
|
||||||
md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0]
|
md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0]
|
||||||
523968 blocks super 1.2 [4/4] [UUUU]
|
523968 blocks super 1.2 [4/4] [UUUU]
|
||||||
resync=DELAYED
|
resync=DELAYED
|
||||||
|
|
||||||
md10 : active raid0 sda1[0] sdb1[1]
|
md10 : active raid0 sda1[0] sdb1[1]
|
||||||
314159265 blocks 64k chunks
|
314159265 blocks 64k chunks
|
||||||
|
|
||||||
|
md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1]
|
||||||
|
4190208 blocks super 1.2 [2/2] [UU]
|
||||||
|
resync=PENDING
|
||||||
|
|
||||||
unused devices: <none>
|
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,
|
// If device is syncing at the moment, get the number of currently synced bytes,
|
||||||
// otherwise that number equals the size of the device.
|
// 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") {
|
if strings.Contains(lines[j], "recovery") ||
|
||||||
|
strings.Contains(lines[j], "resync") &&
|
||||||
|
!strings.Contains(lines[j], "\tresync=") {
|
||||||
syncedBlocks, err = evalBuildline(lines[j])
|
syncedBlocks, err = evalBuildline(lines[j])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return mdStates, fmt.Errorf("error parsing mdstat: %s", err)
|
return mdStates, fmt.Errorf("error parsing mdstat: %s", err)
|
||||||
|
|
|
@ -34,6 +34,7 @@ func TestMdadm(t *testing.T) {
|
||||||
"md7": {"md7", true, 3, 4, 7813735424, 7813735424},
|
"md7": {"md7", true, 3, 4, 7813735424, 7813735424},
|
||||||
"md9": {"md9", true, 4, 4, 523968, 523968},
|
"md9": {"md9", true, 4, 4, 523968, 523968},
|
||||||
"md10": {"md10", true, 2, 2, 314159265, 314159265},
|
"md10": {"md10", true, 2, 2, 314159265, 314159265},
|
||||||
|
"md11": {"md11", true, 2, 2, 4190208, 4190208},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, md := range mdStates {
|
for _, md := range mdStates {
|
||||||
|
|
Loading…
Reference in New Issue