From 358053157dccc04e3aefcfa74ac9f449befb54f1 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Wed, 6 Jun 2018 13:47:33 +0200 Subject: [PATCH] mgr/zabbix: Send more PG information to Zabbix Send information about the status in which many Placement Groups are so that triggers can be made to check if all PGs are active for example. Signed-off-by: Wido den Hollander (cherry picked from commit 9c54334b615362e0a60442c2f41849ed630598ab) --- src/pybind/mgr/zabbix/module.py | 31 +- src/pybind/mgr/zabbix/zabbix_template.xml | 559 ++++++++++++++++++++++ 2 files changed, 584 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/zabbix/module.py b/src/pybind/mgr/zabbix/module.py index df319f7b05c..0baa9e7d4b2 100644 --- a/src/pybind/mgr/zabbix/module.py +++ b/src/pybind/mgr/zabbix/module.py @@ -135,6 +135,30 @@ class Module(MgrModule): self.config[option] = value return True + def get_pg_stats(self): + stats = dict() + + pg_states = ['active', 'peering', 'clean', 'scrubbing', 'undersized', + 'backfilling', 'recovering', 'degraded', 'inconsistent', + 'remapped', 'backfill_toofull', 'wait_backfill', + 'recovery_wait'] + + for state in pg_states: + stats['num_pg_{0}'.format(state)] = 0 + + pg_status = self.get('pg_status') + + stats['num_pg'] = pg_status['num_pgs'] + + for state in pg_status['pgs_by_state']: + states = state['state_name'].split('+') + for s in pg_states: + key = 'num_pg_{0}'.format(s) + if s in states: + stats[key] += state['count'] + + return stats + def get_data(self): data = dict() @@ -226,12 +250,7 @@ class Module(MgrModule): except ValueError: pass - pg_summary = self.get('pg_summary') - num_pg = 0 - for state, num in pg_summary['all'].items(): - num_pg += num - - data['num_pg'] = num_pg + data.update(self.get_pg_stats()) return data diff --git a/src/pybind/mgr/zabbix/zabbix_template.xml b/src/pybind/mgr/zabbix/zabbix_template.xml index a2d1988341c..1ce76605ac0 100644 --- a/src/pybind/mgr/zabbix/zabbix_template.xml +++ b/src/pybind/mgr/zabbix/zabbix_template.xml @@ -281,6 +281,565 @@ + + Number of Placement Groups in Active state + 2 + + 0 + + ceph.num_pg_active + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in active state + 0 + + + Ceph + + + + + + + Number of Placement Groups in Clean state + 2 + + 0 + + ceph.num_pg_clean + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in clean state + 0 + + + Ceph + + + + + + + Number of Placement Groups in Peering state + 2 + + 0 + + ceph.num_pg_peering + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in peering state + 0 + + + Ceph + + + + + + + Number of Placement Groups in Scrubbing state + 2 + + 0 + + ceph.num_pg_scrubbing + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in scrubbing state + 0 + + + Ceph + + + + + + + Number of Placement Groups in Undersized state + 2 + + 0 + + ceph.num_pg_undersized + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in undersized state + 0 + + + Ceph + + + + + + + Number of Placement Groups in Backfilling state + 2 + + 0 + + ceph.num_pg_backfilling + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in backfilling state + 0 + + + Ceph + + + + + + + Number of Placement Groups in degraded state + 2 + + 0 + + ceph.num_pg_degraded + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in degraded state + 0 + + + Ceph + + + + + + + Number of Placement Groups in inconsistent state + 2 + + 0 + + ceph.num_pg_inconsistent + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in inconsistent state + 0 + + + Ceph + + + + + + + Number of Placement Groups in remapped state + 2 + + 0 + + ceph.num_pg_remapped + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in remapped state + 0 + + + Ceph + + + + + + + Number of Placement Groups in recovering state + 2 + + 0 + + ceph.num_pg_recovering + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in recovering state + 0 + + + Ceph + + + + + + + Number of Placement Groups in backfill_toofull state + 2 + + 0 + + ceph.num_pg_backfill_toofull + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in backfill_toofull state + 0 + + + Ceph + + + + + + + Number of Placement Groups in wait_backfill state + 2 + + 0 + + ceph.num_pg_wait_backfill + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in wait_backfill state + 0 + + + Ceph + + + + + + + Number of Placement Groups in recovery_wait state + 2 + + 0 + + ceph.num_pg_recovery_wait + 0 + 90 + 365 + 0 + 3 + + + 0 + + + 0 + 0 + + 0 + + 1 + + + + 0 + 0 + + + + + + Total number of Placement Groups in recovery_wait state + 0 + + + Ceph + + + + + Number of Pools 2 -- 2.47.3