Skip to content

collector/mdadm: report removed disks in node_md_disks#3750

Open
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix-2384-md-removed-state
Open

collector/mdadm: report removed disks in node_md_disks#3750
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix-2384-md-removed-state

Conversation

@locker95

Copy link
Copy Markdown

What

node_md_disks only exposed active / failed / spare. When a raid
member is gone, mdadm shows that slot as removed and /proc/mdstat
marks it with _ (procfs DisksDown). That count was never exported.

Why not node_md_state{state="removed"}?

The issue asked for that series, but "removed" is a component
state, not an array activity state. An array with a missing member is
still active (often degraded). Putting it under node_md_state would
mix two different concepts. Same place as failed/spare is the right fit:

node_md_disks{device="md125",state="removed"} 1

Alert example: node_md_disks{state="removed"} > 0

Changes

  • Emit node_md_disks{state="removed"} from mdStat.DisksDown
  • Fixture md125 (raid1 with one member missing, matching the issue)
  • Unit + e2e expected output

Test

go test ./collector/ -run TestMdadmStats -count=1

Fixes #2384

mdadm -D lists empty raid slots as "removed". Those show up as '_'
in /proc/mdstat (DisksDown in procfs), but node_md_disks only had
active/failed/spare.

Expose state="removed" for that count. Left node_md_state alone —
removed is a per-slot condition, not an array activity state.

Fixes prometheus#2384

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node_md_state did not capture "removed" state

1 participant