collector: add dmmultipath collector for DM-multipath sysfs metrics#3581
Conversation
|
Hi @SuperQ , I created this PR for a new multipath collector. |
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".
There was a problem hiding this comment.
Thanks for testing this!
I've updated the collector to pass the raw device state through, with no normalization or fixed enum.
The device_paths_active metric now counts both SCSI running and NVMe live as active paths, so your NVMe test case should report correctly.
The metric help texts have been updated to be device-type agnostic.
The raw value from /sys/block/<dev>/device/state is passed through as-is in path_state, so deleted, blocked, transport-offline, etc. will all appear as reported by the kernel.
I also opened the sysfs parsing as a separate PR in prometheus/procfs (prometheus/procfs#796) as requested by @simonpasquier.
|
|
||
| // 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.
4666659 to
812baac
Compare
|
Results example: |
|
|
812baac to
a8bde97
Compare
|
@simonpasquier Thank you for catching this! |
66fc703 to
70e0645
Compare
|
PR is failing since its based on prometheus/procfs#796 which is still not merged |
70e0645 to
618342b
Compare
|
Hi @jan--f, @SuperQ — the procfs dependency (prometheus/procfs#796) is now merged. This PR is ready for review. Thank you. |
04dad44 to
cbb85f7
Compare
|
Hi @SuperQ , Please review this PR, Thank you in advance. |
313d3f5 to
cfa742c
Compare
jan--f
left a comment
There was a problem hiding this comment.
The fixture fix might have been better as a separate commit or even a separate PR. Please at least reference Fixes: https://github.com/prometheus/node_exporter/issues/3691 in the PR description.
5b56619 to
a694f19
Compare
a694f19 to
7d7d795
Compare
7d7d795 to
f23e2b3
Compare
|
Rebased. |
cb3c4e3 to
ded7535
Compare
| deviceInfo *prometheus.Desc | ||
| deviceActive *prometheus.Desc | ||
| deviceSizeBytes *prometheus.Desc | ||
| devicePaths *prometheus.Desc | ||
| devicePathsActive *prometheus.Desc | ||
| devicePathsFailed *prometheus.Desc | ||
| pathState *prometheus.Desc |
There was a problem hiding this comment.
One thing that would help with the auto-docs support is to make these package level vars, rather than create the prometheus.Desc every time NewDMMultipathCollector(). We've been slowly migrating to this pattern across collectors.
See #3575
SuperQ
left a comment
There was a problem hiding this comment.
Besides the package var thing, this looks good.
Add a new collector that reads /sys/block/dm-* to discover Device Mapper multipath devices and expose path health metrics. Enabled by default; the collector is a no-op on systems without multipath. Multipath devices are identified by checking that dm/uuid starts with "mpath-". The path state is reported as-is from /sys/block/<dev>/device/state, supporting both SCSI and NVMe devices without hardcoding a fixed set of states. Exposed metrics: - node_dmmultipath_device_info - node_dmmultipath_device_active - node_dmmultipath_device_size_bytes - node_dmmultipath_device_paths - node_dmmultipath_device_paths_active - node_dmmultipath_device_paths_failed - node_dmmultipath_path_state Signed-off-by: Shirly Radco <sradco@redhat.com> Co-authored-by: AI Assistant <noreply@cursor.com>
ded7535 to
32fbfd4
Compare
Thank you @SuperQ , I updated the PR |
Propose a new component that maps CSI volumes to their underlying node block devices, exposing the mapping as Prometheus metrics. This enables correlating storage path health (multipath, NVMe-oF) with impacted Kubernetes workloads via PromQL joins. The exporter is a standalone DaemonSet — it does not introduce new gRPC RPCs or CRDs. It reads kubelet metadata and host sysfs. Related upstream work: - prometheus/node_exporter#3581 (dmmultipath collector, merged) - prometheus/node_exporter#3579 (nvmesubsystem collector, merged) - openshift-virtualization/csi-volume-device-exporter#1 (reference impl) Signed-off-by: Shirly Radco <sradco@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Propose a new component that maps CSI volumes to their underlying node block devices, exposing the mapping as Prometheus metrics. This enables correlating storage path health (multipath, NVMe-oF) with impacted Kubernetes workloads via PromQL joins. The exporter is a standalone DaemonSet — it does not introduce new gRPC RPCs or CRDs. It reads kubelet metadata and host sysfs. Related upstream work: - prometheus/node_exporter#3581 (dmmultipath collector, merged) - prometheus/node_exporter#3579 (nvmesubsystem collector, merged) - openshift-virtualization/csi-volume-device-exporter#1 (reference impl) Signed-off-by: Shirly Radco <sradco@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
* [FEATURE] mountstats: Add NFS mountpoint info metric #3554 * [FEATURE] nvmesubsystem: Add new collector #3579 * [FEATURE] dmmultipath: Add new collector #3581 * [FEATURE] infiniband: Add device filtering option #3694 * [ENHANCEMENT] hwmon: disambiguate colliding chip labels #3646 * [ENHANCEMENT] cpufreq: Add support for cpuinfo_avg_freq #3712 * [ENHANCEMENT] filesystem: Support ext4 super block emergency_ro flag #3717 * [ENHANCEMENT] edac: Add per-channel error metrics with DIMM labels #3720 * [BUGFIX] diskstats: Only enforce mutual exclusivity for non-empty values #3617 * [BUGFIX] thermal_zone: Handle EINVAL errors gracefully #3657 * [BUGFIX] filesystem: Add comma separator in mount options #3659 * [BUGFIX] diskstats: Fix rotational queue stats scrape regression #3686 * [BUGFIX] filesystem: Prevent panic on mount points with non-UTF-8 names #3687 Signed-off-by: Ben Kochie <superq@gmail.com>
Summary
Add a new disabled-by-default
dmmultipathcollector that reads/sys/block/dm-*/dm/to expose Device Mapper multipath devicehealth metrics.
Exposed metrics
Enable
No special permissions required — reads only world-readable sysfs attributes.
Dependencies
build(deps): bump prometheus/procfs to v0.21.1)Test plan
testutil.GatherAndComparefor all metrics