From e855c749124088f7407831e148de9776aa5514cc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 4 Mar 2020 14:21:10 -0600 Subject: [PATCH] mgr/cephadm: fix prom reconfig loop when dashboard is disabled We need to consider the mgrs a dep even if the prometheus module isn't enabled, so that we are consistent with _calc_daemon_deps() and don't reconfig prom in a loop. Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/module.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index cf80d521ee34d..9c0deaa97d6af 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2397,6 +2397,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): # scrape mgrs mgr_scrape_list = [] mgr_map = self.get('mgr_map') + port = None t = mgr_map.get('services', {}).get('prometheus', None) if t: t = t.split('/')[2] @@ -2404,16 +2405,20 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): port = '9283' if ':' in t: port = t.split(':')[1] - # get standbys too. assume that they are all on the same port - # as the active. - for dd in self.cache.get_daemons_by_service('mgr'): - deps.append(dd.name()) - if dd.daemon_id == self.get_mgr_id(): - continue - hi = self.inventory.get(dd.hostname, None) - if hi: - addr = hi.get('addr', dd.hostname) - mgr_scrape_list.append(addr.split(':')[0] + ':' + port) + # scan all mgrs to generate deps and to get standbys too. + # assume that they are all on the same port as the active mgr. + for dd in self.cache.get_daemons_by_service('mgr'): + # we consider the mgr a dep even if the prometheus module is + # disabled in order to be consistent with _calc_daemon_deps(). + deps.append(dd.name()) + if not port: + continue + if dd.daemon_id == self.get_mgr_id(): + continue + hi = self.inventory.get(dd.hostname, None) + if hi: + addr = hi.get('addr', dd.hostname) + mgr_scrape_list.append(addr.split(':')[0] + ':' + port) # scrape node exporters node_configs = '' -- 2.39.5