From: Boris Ranto Date: Fri, 16 Feb 2018 03:53:39 +0000 (+0100) Subject: mgr/prometheus: Skip bogus entries X-Git-Tag: v12.2.5~58^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5bce4bf1db589d8b964e54cf684a9b90149ad883;p=ceph.git 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 (cherry picked from commit 965aaad5273eac311e4535559a0e0a9df8a39bee) --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 0da635b5572d..945a6b5a3364 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -304,6 +304,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,