Skip to content

collector: add dmmultipath collector for DM-multipath sysfs metrics#3581

Open
sradco wants to merge 1 commit intoprometheus:masterfrom
sradco:add_collector_dmmultipath
Open

collector: add dmmultipath collector for DM-multipath sysfs metrics#3581
sradco wants to merge 1 commit intoprometheus:masterfrom
sradco:add_collector_dmmultipath

Conversation

@sradco
Copy link

@sradco sradco commented Mar 12, 2026

Add a new disabled-by-default collector that reads /sys/block/dm-*
to discover Device Mapper multipath devices and expose path health
metrics. Multipath devices are identified by checking that dm/uuid
starts with "mpath-", which distinguishes them from LVM or other
DM device types.

No special permissions are required, the collector reads only
world-readable sysfs attributes.

Exposed metrics:

  • node_dmmultipath_device_info
  • node_dmmultipath_device_active
  • node_dmmultipath_device_size_bytes
  • node_dmmultipath_device_paths_{total,active,failed}
  • node_dmmultipath_path_state

Signed-off-by: Shirly Radco sradco@redhat.com
Co-authored-by: AI Assistant noreply@cursor.com

@sradco
Copy link
Author

sradco commented Mar 12, 2026

Hi @SuperQ , I created this PR for a new multipath collector.
I would appreciate your review.

Add a new disabled-by-default collector that reads /sys/block/dm-*
to discover Device Mapper multipath devices and expose path health
metrics. Multipath devices are identified by checking that dm/uuid
starts with "mpath-", which distinguishes them from LVM or other
DM device types.

No special permissions are required — the collector reads only
world-readable sysfs attributes.

Exposed metrics:
- node_dmmultipath_device_info
- node_dmmultipath_device_active
- node_dmmultipath_device_size_bytes
- node_dmmultipath_device_paths_{total,active,failed}
- node_dmmultipath_path_state

Signed-off-by: Shirly Radco <sradco@redhat.com>
Co-authored-by: AI Assistant <noreply@cursor.com>
@sradco sradco force-pushed the add_collector_dmmultipath branch from 2ec5320 to 4666659 Compare March 12, 2026 09:55
@sradco sradco changed the title collector: add dmmultipath collector for multipathd socket metrics ollector: add dmmultipath collector for DM-multipath sysfs metrics Mar 12, 2026
@sradco sradco changed the title ollector: add dmmultipath collector for DM-multipath sysfs metrics collector: add dmmultipath collector for DM-multipath sysfs metrics Mar 12, 2026
Comment on lines +47 to +56
func normalizeDMPathState(raw string) string {
switch raw {
case "running", "offline", "blocked", "transport-offline":
return raw
case "created", "quiesce":
return raw
default:
return "unknown"
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The individual paths of multipath can be different devices with different states. For example,
I tested with NVMeoF in dm-multipath (to test #3579 in a single virtual machine) and NVMe states are quite different. A "live" NVMe device ends up as "unknown" and node_dmmultipath_device_paths_active is then zero.

If only SCSI is being considered for this collector, then it should be reflected in help texts of all metrics or the collector documentation, not only in node_dmmultipath_path_state. I understand that NVMe has its own multipath and typically does not use dm-multipath, still, explicit is better than implicit.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, the Linux kernel can report more states for SCSI. I'd appreciate at least a comment why e.g. "deleted" is reported as "unknown".


// scanDMMultipathDevices discovers DM-multipath devices by scanning
// /sys/block/dm-* and filtering on dm/uuid prefix "mpath-".
func scanDMMultipathDevices(sysfsBase string) ([]dmMultipathDevice, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this functionality should probably land into https://github.com/prometheus/procfs first.

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.

3 participants