From 85a93dcdddc4cd82c8935bfe123cb20f13f8928a Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 11 Aug 2017 13:09:24 +0200 Subject: [PATCH] pybind/mgr/prometheus: export cluster-wide pg stats, not per osd Signed-off-by: Jan Fajerski (cherry picked from commit 13b1236b96d4563e0985cad40d3009b60cc475e7) --- src/pybind/mgr/prometheus/module.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 057aa31627dde..cdd679e5d44d3 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -275,7 +275,6 @@ class Module(MgrModule): 'gauge', path, 'PG {}'.format(state), - ('osd',), ) for state in DF_CLUSTER: path = 'cluster_{}'.format(state) @@ -384,18 +383,17 @@ class Module(MgrModule): def get_pg_status(self): # TODO add per pool status? - pg_s = self.get('pg_summary')['by_osd'] - for osd in pg_s: - reported_pg_s = [(s,v) for key, v in pg_s[osd].items() for s in - key.split('+')] - for state, value in reported_pg_s: - path = 'pg_{}'.format(state) - self.metrics[path].set(value, (osd,)) - reported_states = [s[0] for s in reported_pg_s] - for state in PG_STATES: - path = 'pg_{}'.format(state) - if state not in reported_states: - self.metrics[path].set(0, (osd,)) + pg_s = self.get('pg_summary')['all'] + reported_pg_s = [(s,v) for key, v in pg_s.items() for s in + key.split('+')] + for state, value in reported_pg_s: + path = 'pg_{}'.format(state) + self.metrics[path].set(value) + reported_states = [s[0] for s in reported_pg_s] + for state in PG_STATES: + path = 'pg_{}'.format(state) + if state not in reported_states: + self.metrics[path].set(0) def get_metadata(self): osd_map = self.get('osd_map') -- 2.39.5