From: Aashish Sharma Date: Mon, 24 Apr 2023 06:14:11 +0000 (+0530) Subject: mgr/dashboard: fix CephPGImbalance alert X-Git-Tag: v18.1.0~126^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F51253%2Fhead;p=ceph.git mgr/dashboard: fix CephPGImbalance alert Fixes: https://tracker.ceph.com/issues/55568 Signed-off-by: Aashish Sharma (cherry picked from commit 8b5c4d27c20bce82bb46064a2cd2928a0736e6cd) --- diff --git a/src/pybind/mgr/dashboard/controllers/prometheus.py b/src/pybind/mgr/dashboard/controllers/prometheus.py index bed919327b6f..d9a360799d9e 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')