Skip to content

Commit 5208f01

Browse files
committed
collectors/mdadm_linux: support reshape status
Signed-off-by: Philipp Born <git@pborn.eu>
1 parent e6a9cfb commit 5208f01

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

collector/fixtures/proc/mdstat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@ md120 : active linear sda1[1] sdb1[0]
5757
md101 : active (read-only) raid0 sdb[2] sdd[1] sdc[0]
5858
322560 blocks super 1.2 512k chunks
5959

60+
md42 : active raid5 sda1[3](S) sdd1[0] sde1[1]
61+
1953381440 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/2] [UU_]
62+
[===========>.........] reshape = 56.1% (1096879076/1953381440) finish=1868.1min speed=7640K/sec
63+
bitmap: 4/15 pages [16KB], 65536KB chunk
64+
6065
unused devices: <none>

collector/mdadm_linux.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ var (
5858
[]string{"device"},
5959
prometheus.Labels{"state": "recovering"},
6060
)
61+
reshapingDesc = prometheus.NewDesc(
62+
prometheus.BuildFQName(namespace, "md", "state"),
63+
"Indicates the state of md-device.",
64+
[]string{"device"},
65+
prometheus.Labels{"state": "reshaping"},
66+
)
6167
resyncDesc = prometheus.NewDesc(
6268
prometheus.BuildFQName(namespace, "md", "state"),
6369
"Indicates the state of md-device.",
@@ -166,6 +172,13 @@ func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error {
166172
mdStat.Name,
167173
)
168174

175+
ch <- prometheus.MustNewConstMetric(
176+
reshapingDesc,
177+
prometheus.GaugeValue,
178+
stateVals["reshaping"],
179+
mdStat.Name,
180+
)
181+
169182
ch <- prometheus.MustNewConstMetric(
170183
recoveringDesc,
171184
prometheus.GaugeValue,

0 commit comments

Comments
 (0)