From d85a1ea493ca2584a7de5ad0dab1e066de7e6dde Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Mon, 2 Jul 2018 16:36:52 +0200 Subject: [PATCH] mgr: Ignore daemon if no metadata was returned It can happen that the Mgr does not return any metadata for a given daemon as it might not be available at that moment. None is returned by the get_metadata() method at that moment and both the Influx and Telegraf module should then ignore the daemon in their statistics and continue on to the next daemon. Signed-off-by: Wido den Hollander (cherry picked from commit 02569c88341a6dcc8aee5626f10ac2927c2cf064) --- src/pybind/mgr/influx/module.py | 3 +++ src/pybind/mgr/telegraf/module.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index 09c93af370ef..379668a81a80 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -152,6 +152,9 @@ class Module(MgrModule): data = [] for osd_id, stats in six.iteritems(osd_sum): metadata = self.get_metadata('osd', "%s" % osd_id) + if not metadata: + continue + for stat in stats: point_1 = { "measurement": "ceph_pg_summary_osd", diff --git a/src/pybind/mgr/telegraf/module.py b/src/pybind/mgr/telegraf/module.py index ab47f39528fc..179e67ff2fa0 100644 --- a/src/pybind/mgr/telegraf/module.py +++ b/src/pybind/mgr/telegraf/module.py @@ -110,6 +110,8 @@ class Module(MgrModule): for daemon, counters in six.iteritems(self.get_all_perf_counters()): svc_type, svc_id = daemon.split('.', 1) metadata = self.get_metadata(svc_type, svc_id) + if not metadata: + continue for path, counter_info in counters.items(): if counter_info['type'] & self.PERFCOUNTER_HISTOGRAM: -- 2.47.3