X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Fcontrollers%2Fprometheus.py;h=b639d88262739a70027a409bf0c34404a2ddd8f2;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=5aab37596e1ecd5ccbb22466d30187b056805d40;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/controllers/prometheus.py b/ceph/src/pybind/mgr/dashboard/controllers/prometheus.py index 5aab37596..b639d8826 100644 --- a/ceph/src/pybind/mgr/dashboard/controllers/prometheus.py +++ b/ceph/src/pybind/mgr/dashboard/controllers/prometheus.py @@ -61,20 +61,24 @@ class PrometheusRESTController(RESTController): user = None password = None cert_file = None - secure_monitoring_stack = bool(mgr.get_module_option_ex('cephadm', - 'secure_monitoring_stack', - 'false')) - if secure_monitoring_stack: - cmd = {'prefix': f'orch {module_name} access info'} - ret, out, _ = mgr.mon_command(cmd) - if ret == 0 and out is not None: - access_info = json.loads(out) - user = access_info['user'] - password = access_info['password'] - certificate = access_info['certificate'] - cert_file = tempfile.NamedTemporaryFile(delete=False) - cert_file.write(certificate.encode('utf-8')) - cert_file.flush() + + orch_backend = mgr.get_module_option_ex('orchestrator', 'orchestrator') + if orch_backend == 'cephadm': + secure_monitoring_stack = mgr.get_module_option_ex('cephadm', + 'secure_monitoring_stack', + False) + if secure_monitoring_stack: + cmd = {'prefix': f'orch {module_name} get-credentials'} + ret, out, _ = mgr.mon_command(cmd) + if ret == 0 and out is not None: + access_info = json.loads(out) + user = access_info['user'] + password = access_info['password'] + certificate = access_info['certificate'] + cert_file = tempfile.NamedTemporaryFile(delete=False) + cert_file.write(certificate.encode('utf-8')) + cert_file.flush() + return user, password, cert_file def _get_api_url(self, host):