From 11b37a9353a9bfd0e4b0ba67dbfd8511a2792184 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Thu, 24 Jul 2025 18:55:10 +0530 Subject: [PATCH] mgr/prometheus: add share name as label to SMB_METADATA metric Fixes: https://tracker.ceph.com/issues/72068 Signed-off-by: Avan Thakkar (cherry picked from commit fcce415a351c12826bc94faeae02c9000975a245) --- src/pybind/mgr/prometheus/module.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 4a6d706785299..a6df918078b16 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -113,7 +113,7 @@ DISK_OCCUPATION = ('ceph_daemon', 'device', 'db_device', NUM_OBJECTS = ['degraded', 'misplaced', 'unfound'] SMB_METADATA = ('smb_version', 'volume', - 'subvolume_group', 'subvolume', 'netbiosname') + 'subvolume_group', 'subvolume', 'netbiosname', 'share') alert_metric = namedtuple('alert_metric', 'name description') HEALTH_CHECKS = [ @@ -1800,6 +1800,7 @@ class Module(MgrModule, OrchestratorClientMixin): self.log.debug("Skipping share with missing cluster_id") continue + share_id = resource.get('share_id', '') cephfs = resource.get('cephfs', {}) cephfs_volume = cephfs.get('volume', '') cephfs_subvolumegroup = cephfs.get('subvolumegroup', '_nogroup') @@ -1809,7 +1810,8 @@ class Module(MgrModule, OrchestratorClientMixin): cephfs_volume, cephfs_subvolumegroup, cephfs_subvolume, - cluster_id + cluster_id, + share_id )) except json.JSONDecodeError: self.log.error("Failed to decode SMB module output") -- 2.39.5