From: Aashish Sharma Date: Mon, 8 May 2023 07:19:13 +0000 (+0530) Subject: mgr/dashboard: fix regression caused by cephPgImabalance alert X-Git-Tag: v18.1.0~96^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=059d24f62f22445c08bcd29677d64930c3a7a23d;p=ceph.git mgr/dashboard: fix regression caused by cephPgImabalance alert because of an earlier fix delivered, there is a regression caused by it due to which alerts are not getting displayed in the active alerts tab. This PR intends to fix this issue. Fixes: https://tracker.ceph.com/issues/59666 Signed-off-by: Aashish Sharma (cherry picked from commit d0a1431fb836f1dd227df85f9e75e098edfdeac9) --- diff --git a/src/pybind/mgr/dashboard/controllers/prometheus.py b/src/pybind/mgr/dashboard/controllers/prometheus.py index d9a360799d9..213c6b646e3 100644 --- a/src/pybind/mgr/dashboard/controllers/prometheus.py +++ b/src/pybind/mgr/dashboard/controllers/prometheus.py @@ -108,11 +108,7 @@ class PrometheusRESTController(RESTController): 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': - alerts_info.append(v) - alerts_info = [i for i in alerts_info if i['alertname'] != 'CephPGImbalance'] + alerts_info = [alert for alert in content['data'] if alert['labels']['alertname'] != 'CephPGImbalance'] # noqa E501 #pylint: disable=line-too-long return alerts_info return content['data'] return content