From: Jason Dillaman Date: Tue, 16 Jun 2020 14:33:32 +0000 (-0400) Subject: mgr/prometheus: automatically discover RBD pools for stats gathering X-Git-Tag: v15.2.5~60^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=29a104f6db521f2128c9265d1608902f531ddc58;p=ceph.git mgr/prometheus: automatically discover RBD pools for stats gathering To simplify configuration, the existing 'rbd_stats_pools' config option now accepts '*' as a wildcard for the pool and/or namespace portion of the [/] spec. Fixes: https://tracker.ceph.com/issues/46034 Signed-off-by: Jason Dillaman (cherry picked from commit 62986a1c3cde4262a76b37529fa865d3c036651d) Conflicts: src/pybind/mgr/prometheus/module.py Do not loose mypy type checks --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index bc0e41ed482..1fdf08debab 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -742,7 +742,8 @@ class Module(MgrModule): # Parse rbd_stats_pools option, which is a comma or space separated # list of pool[/namespace] entries. If no namespace is specifed the - # stats are collected for every namespace in the pool. + # stats are collected for every namespace in the pool. The wildcard + # '*' can be used to indicate all pools or namespaces pools_string = self.get_localized_module_option('rbd_stats_pools', '') pool_keys = [] for x in re.split('[\s,]+', pools_string): @@ -773,11 +774,12 @@ class Module(MgrModule): # empty set means collect for all namespaces pools[pool_name] = set() continue + if pool_name not in pools: pools[pool_name] = set() elif not pools[pool_name]: continue - pools[pool_name].add(s[1]) + pools[pool_name].add(namespace_name) rbd_stats_pools = {} for pool_id in self.rbd_stats['pools'].keys():