collector: add dmmultipath collector for DM-multipath sysfs metrics#3581
collector: add dmmultipath collector for DM-multipath sysfs metrics#3581sradco wants to merge 1 commit intoprometheus:masterfrom
Conversation
|
Hi @SuperQ , I created this PR for a new multipath collector. |
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>
2ec5320 to
4666659
Compare
| func normalizeDMPathState(raw string) string { | ||
| switch raw { | ||
| case "running", "offline", "blocked", "transport-offline": | ||
| return raw | ||
| case "created", "quiesce": | ||
| return raw | ||
| default: | ||
| return "unknown" | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
this functionality should probably land into https://github.com/prometheus/procfs first.
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:
Signed-off-by: Shirly Radco sradco@redhat.com
Co-authored-by: AI Assistant noreply@cursor.com