From 31e7b6a0d3e962b03e45871f54f226d4aaafdedb Mon Sep 17 00:00:00 2001 From: Aashish Sharma Date: Mon, 24 Apr 2023 11:44:11 +0530 Subject: [PATCH] mgr/dashboard: fix CephPGImbalance alert Fixes: https://tracker.ceph.com/issues/55568 Signed-off-by: Aashish Sharma (cherry picked from commit 8b5c4d27c20bce82bb46064a2cd2928a0736e6cd) --- src/pybind/mgr/dashboard/controllers/prometheus.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/prometheus.py b/src/pybind/mgr/dashboard/controllers/prometheus.py index bed919327b6f4..d9a360799d9eb 100644 --- a/src/pybind/mgr/dashboard/controllers/prometheus.py +++ b/src/pybind/mgr/dashboard/controllers/prometheus.py @@ -105,14 +105,15 @@ class PrometheusRESTController(RESTController): component='prometheus') balancer_status = self.balancer_status() if content['status'] == 'success': # pylint: disable=R1702 + alerts_info = [] if 'data' in content: if balancer_status['active'] and balancer_status['no_optimization_needed'] and path == '/alerts': # noqa E501 #pylint: disable=line-too-long for alert in content['data']: for k, v in alert.items(): if k == 'labels': - for key, value in v.items(): - if key == 'alertname' and value == 'CephPGImbalance': - content['data'].remove(alert) + alerts_info.append(v) + alerts_info = [i for i in alerts_info if i['alertname'] != 'CephPGImbalance'] + return alerts_info return content['data'] return content raise DashboardException(content, http_status_code=400, component='prometheus') -- 2.39.5