From e6ff23d1297cbcf5da030178c53e14a6b6ce5f43 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Tue, 2 Apr 2024 15:15:48 +0530 Subject: [PATCH] mgr/dashboard: fix duplicate grafana panels when on mgr failover Fixes: https://tracker.ceph.com/issues/64970 Signed-off-by: Avan Thakkar --- .../templates/services/prometheus/prometheus.yml.j2 | 7 +++++++ src/pybind/mgr/cephadm/tests/test_services.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2 b/src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2 index 931913668ae8c..faccc8f6de26c 100644 --- a/src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2 +++ b/src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2 @@ -41,6 +41,10 @@ scrape_configs: tls_config: ca_file: mgr_prometheus_cert.pem honor_labels: true + relabel_configs: + - source_labels: [instance] + target_label: instance + replacement: 'ceph_cluster' http_sd_configs: - url: {{ mgr_prometheus_sd_url }} basic_auth: @@ -54,6 +58,9 @@ scrape_configs: - source_labels: [__address__] target_label: cluster replacement: {{ cluster_fsid }} + - source_labels: [instance] + target_label: instance + replacement: 'ceph_cluster' http_sd_configs: - url: {{ mgr_prometheus_sd_url }} {% endif %} diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index fd48e09636e5c..05f402b309a40 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -736,6 +736,9 @@ def test_prometheus_config_security_disabled(self, _run_cephadm, cephadm_module: - source_labels: [__address__] target_label: cluster replacement: fsid + - source_labels: [instance] + target_label: instance + replacement: 'ceph_cluster' http_sd_configs: - url: http://[::1]:8765/sd/prometheus/sd-config?service=mgr-prometheus @@ -895,6 +898,10 @@ def gen_cert(host, addr): tls_config: ca_file: mgr_prometheus_cert.pem honor_labels: true + relabel_configs: + - source_labels: [instance] + target_label: instance + replacement: 'ceph_cluster' http_sd_configs: - url: https://[::1]:8765/sd/prometheus/sd-config?service=mgr-prometheus basic_auth: