From 1369763067ae672ad311823a44e0cdb826dd494e Mon Sep 17 00:00:00 2001 From: Andrea De Pasquale Date: Thu, 20 Jul 2017 17:04:33 +0200 Subject: [PATCH] Change raid0 status line regexp for mdadm collector (#619) --- collector/fixtures/e2e-output.txt | 5 +++++ collector/fixtures/proc/mdstat | 3 +++ collector/mdadm_linux.go | 2 +- collector/mdadm_linux_test.go | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 78d03de..1b80545 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -905,6 +905,7 @@ node_md_blocks{device="md00"} 4.186624e+06 node_md_blocks{device="md10"} 3.14159265e+08 node_md_blocks{device="md11"} 4.190208e+06 node_md_blocks{device="md12"} 3.886394368e+09 +node_md_blocks{device="md126"} 1.855870976e+09 node_md_blocks{device="md127"} 3.12319552e+08 node_md_blocks{device="md219"} 7932 node_md_blocks{device="md3"} 5.853468288e+09 @@ -920,6 +921,7 @@ node_md_blocks_synced{device="md00"} 4.186624e+06 node_md_blocks_synced{device="md10"} 3.14159265e+08 node_md_blocks_synced{device="md11"} 4.190208e+06 node_md_blocks_synced{device="md12"} 3.886394368e+09 +node_md_blocks_synced{device="md126"} 1.855870976e+09 node_md_blocks_synced{device="md127"} 3.12319552e+08 node_md_blocks_synced{device="md219"} 7932 node_md_blocks_synced{device="md3"} 5.853468288e+09 @@ -935,6 +937,7 @@ node_md_disks{device="md00"} 1 node_md_disks{device="md10"} 2 node_md_disks{device="md11"} 2 node_md_disks{device="md12"} 2 +node_md_disks{device="md126"} 2 node_md_disks{device="md127"} 2 node_md_disks{device="md219"} 0 node_md_disks{device="md3"} 8 @@ -950,6 +953,7 @@ node_md_disks_active{device="md00"} 1 node_md_disks_active{device="md10"} 2 node_md_disks_active{device="md11"} 2 node_md_disks_active{device="md12"} 2 +node_md_disks_active{device="md126"} 2 node_md_disks_active{device="md127"} 2 node_md_disks_active{device="md219"} 0 node_md_disks_active{device="md3"} 8 @@ -965,6 +969,7 @@ node_md_is_active{device="md00"} 1 node_md_is_active{device="md10"} 1 node_md_is_active{device="md11"} 1 node_md_is_active{device="md12"} 1 +node_md_is_active{device="md126"} 1 node_md_is_active{device="md127"} 1 node_md_is_active{device="md219"} 0 node_md_is_active{device="md3"} 1 diff --git a/collector/fixtures/proc/mdstat b/collector/fixtures/proc/mdstat index 393b3fc..3f8c9c3 100644 --- a/collector/fixtures/proc/mdstat +++ b/collector/fixtures/proc/mdstat @@ -37,6 +37,9 @@ md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1] md12 : active raid0 sdc2[0] sdd2[1] 3886394368 blocks super 1.2 512k chunks +md126 : active raid0 sdb[1] sdc[0] + 1855870976 blocks super external:/md127/0 128k chunks + md219 : inactive sdb[2](S) sdc[1](S) sda[0](S) 7932 blocks super external:imsm diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index be78e97..205449f 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -29,7 +29,7 @@ import ( var ( statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) - raid0lineRE = regexp.MustCompile(`(\d+) blocks( super ([0-9\.])*)? \d+k chunks`) + raid0lineRE = regexp.MustCompile(`(\d+) blocks .*\d+k chunks`) buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`) unknownPersonalityLineRE = regexp.MustCompile(`(\d+) blocks (.*)`) raidPersonalityRE = regexp.MustCompile(`raid[0-9]+`) diff --git a/collector/mdadm_linux_test.go b/collector/mdadm_linux_test.go index 94e1ffe..30776bf 100644 --- a/collector/mdadm_linux_test.go +++ b/collector/mdadm_linux_test.go @@ -36,6 +36,7 @@ func TestMdadm(t *testing.T) { "md10": {"md10", true, 2, 2, 314159265, 314159265}, "md11": {"md11", true, 2, 2, 4190208, 4190208}, "md12": {"md12", true, 2, 2, 3886394368, 3886394368}, + "md126": {"md126", true, 2, 2, 1855870976, 1855870976}, "md219": {"md219", false, 0, 0, 7932, 7932}, "md00": {"md00", true, 1, 1, 4186624, 4186624}, }