From 965aaad5273eac311e4535559a0e0a9df8a39bee Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Fri, 16 Feb 2018 04:53:39 +0100 Subject: [PATCH] mgr/prometheus: Skip bogus entries The osd data can contain bogus '-' entries, skip these when populating osd metadata and disk occupation. Signed-off-by: Boris Ranto --- src/pybind/mgr/prometheus/module.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 74aceeaad44ea..fec46138ae9c7 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -284,6 +284,12 @@ class Module(MgrModule): id_ = osd['osd'] p_addr = osd['public_addr'].split(':')[0] c_addr = osd['cluster_addr'].split(':')[0] + if p_addr == "-" or c_addr == "-": + self.log.info( + "Missing address metadata for osd {0}, skipping occupation" + " and metadata records for this osd".format(id_) + ) + continue dev_class = next((osd for osd in osd_devices if osd['id'] == id_)) self.metrics['osd_metadata'].set(1, ( c_addr, -- 2.39.5