From: Redouane Kachach Date: Mon, 27 Mar 2023 10:56:58 +0000 (+0200) Subject: mgr/cephadm: fixing ceph-exporter prometheus's job section X-Git-Tag: v18.1.0~130^2~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=557c082fb0fbf483385ab6cb33ba1986d9ad9d7c;p=ceph.git mgr/cephadm: fixing ceph-exporter prometheus's job section Fixes: https://tracker.ceph.com/issues/59170 Signed-off-by: Redouane Kachach (cherry picked from commit a2927e0cdd76f10f3b6e067b8de387f358016cc9) --- 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 acbda6b9911..b5684399455 100644 --- a/src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2 +++ b/src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2 @@ -89,9 +89,21 @@ scrape_configs: {% if ceph_exporter_sd_url %} - job_name: 'ceph-exporter' +{% if secure_monitoring_stack %} honor_labels: true + scheme: https + tls_config: + ca_file: root_cert.pem http_sd_configs: - url: {{ ceph_exporter_sd_url }} + basic_auth: + username: {{ service_discovery_username }} + password: {{ service_discovery_password }} tls_config: ca_file: root_cert.pem +{% else %} + honor_labels: true + http_sd_configs: + - url: {{ ceph_exporter_sd_url }} +{% endif %} {% endif %} diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index 8e37836c77b..51464600599 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -528,8 +528,6 @@ class TestMonitoring: honor_labels: true http_sd_configs: - url: http://[::1]:8765/sd/prometheus/sd-config?service=ceph-exporter - tls_config: - ca_file: root_cert.pem """).lstrip() _run_cephadm.assert_called_with( @@ -650,8 +648,14 @@ class TestMonitoring: - job_name: 'ceph-exporter' honor_labels: true + scheme: https + tls_config: + ca_file: root_cert.pem http_sd_configs: - url: https://[::1]:8765/sd/prometheus/sd-config?service=ceph-exporter + basic_auth: + username: admin + password: fake_password tls_config: ca_file: root_cert.pem """).lstrip()