From: Afreen Misbah Date: Thu, 25 Jun 2026 18:58:21 +0000 (+0530) Subject: mgr/prometheus: Rename node_proxy_memory_capacity_mib to node_proxy_memory_capacity_bytes X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ae0567e98a545f13b0c47c4b0e54220cf21e6eb5;p=ceph.git mgr/prometheus: Rename node_proxy_memory_capacity_mib to node_proxy_memory_capacity_bytes Prometheus naming conventions require base units (bytes not MiB) Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 45b14fe6502..06002b7b195 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -145,6 +145,7 @@ NODE_PROXY_STORAGE_LABELS = ('hostname', 'device', 'model', 'protocol') NODE_PROXY_CPU_LABELS = ('hostname', 'cpu', 'manufacturer', 'model') NODE_PROXY_MEMORY_LABELS = ('hostname', 'dimm', 'type', 'manufacturer') +MIB_TO_BYTES = 1048576 NODE_PROXY_HEALTH_LABELS = ('hostname', 'component', 'category') @@ -1026,10 +1027,10 @@ class Module(MgrModule, OrchestratorClientMixin): NODE_PROXY_CPU_LABELS ) - metrics['node_proxy_memory_capacity_mib'] = Metric( + metrics['node_proxy_memory_capacity_bytes'] = Metric( 'gauge', - 'node_proxy_memory_capacity_mib', - 'Memory capacity in MiB', + 'node_proxy_memory_capacity_bytes', + 'Memory capacity in bytes', NODE_PROXY_MEMORY_LABELS ) @@ -2102,19 +2103,29 @@ class Module(MgrModule, OrchestratorClientMixin): for sys_id, dimms in status.get('memory', {}).items(): for dimm_id, dimm in dimms.items(): - capacity = dimm.get('capacity_mi_b', 0) + capacity_mib = dimm.get('capacity_mi_b', 0) + capacity_bytes = capacity_mib * MIB_TO_BYTES labels = ( host, dimm_id, dimm.get('memory_device_type', 'unknown'), dimm.get('manufacturer', 'unknown') ) - self.metrics['node_proxy_memory_capacity_mib'].set(capacity, labels) + self.metrics['node_proxy_memory_capacity_bytes'].set(capacity_bytes, labels) for category in ['storage', 'processors', 'memory', 'power', 'fans', 'network', 'temperatures']: for sys_id, components in status.get(category, {}).items(): for comp_id, comp in components.items(): - health_str = comp.get('status', {}).get('health', 'Unknown') + if not isinstance(comp, dict): + continue + status_val = comp.get('status', {}) + if isinstance(status_val, dict): + health_str = status_val.get('health', 'Unknown') + elif isinstance(status_val, str): + health_str = status_val + else: + health_str = 'Unknown' + if health_str == 'OK': health_value = 0 elif health_str in ['Warning', 'Degraded']: