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 <branto@redhat.com>
This commit is contained in:
Boris Ranto 2018-02-16 04:53:39 +01:00
parent 9bc0b8b985
commit 965aaad527

View File

@ -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,