mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Fix mdadm collector for resync=PENDING.
Add fix for mdadm devices in state `resync=PENDING`. * Update test and fixture.
This commit is contained in:
		
							parent
							
								
									61f36ac1ab
								
							
						
					
					
						commit
						64b82596ef
					
				|  | @ -500,6 +500,7 @@ node_load5 0.37 | |||
| # TYPE node_md_blocks gauge | ||||
| node_md_blocks{device="md0"} 248896 | ||||
| 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="md3"} 5.853468288e+09 | ||||
| node_md_blocks{device="md4"} 4.883648e+06 | ||||
|  | @ -511,6 +512,7 @@ node_md_blocks{device="md9"} 523968 | |||
| # TYPE node_md_blocks_synced gauge | ||||
| node_md_blocks_synced{device="md0"} 248896 | ||||
| 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="md3"} 5.853468288e+09 | ||||
| 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 | ||||
| node_md_disks{device="md0"} 2 | ||||
| node_md_disks{device="md10"} 2 | ||||
| node_md_disks{device="md11"} 2 | ||||
| node_md_disks{device="md127"} 2 | ||||
| node_md_disks{device="md3"} 8 | ||||
| node_md_disks{device="md4"} 2 | ||||
|  | @ -533,6 +536,7 @@ node_md_disks{device="md9"} 4 | |||
| # TYPE node_md_disks_active gauge | ||||
| node_md_disks_active{device="md0"} 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="md3"} 8 | ||||
| node_md_disks_active{device="md4"} 2 | ||||
|  | @ -544,6 +548,7 @@ node_md_disks_active{device="md9"} 4 | |||
| # TYPE node_md_is_active gauge | ||||
| node_md_is_active{device="md0"} 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="md3"} 1 | ||||
| node_md_is_active{device="md4"} 0 | ||||
|  |  | |||
|  | @ -30,4 +30,8 @@ md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0] | |||
| 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 | ||||
| 
 | ||||
| unused devices: <none> | ||||
|  |  | |||
|  | @ -190,7 +190,7 @@ 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") { | ||||
| 		if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") && !strings.Contains(lines[j], "resync=DELAYED") && !strings.Contains(lines[j], "resync=PENDING") { | ||||
| 			syncedBlocks, err = evalBuildline(lines[j]) | ||||
| 			if err != nil { | ||||
| 				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}, | ||||
| 		"md9":   {"md9", true, 4, 4, 523968, 523968}, | ||||
| 		"md10":  {"md10", true, 2, 2, 314159265, 314159265}, | ||||
| 		"md11":  {"md11", true, 2, 2, 4190208, 4190208}, | ||||
| 	} | ||||
| 
 | ||||
| 	for _, md := range mdStates { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue