]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
collectors: No update on fetch osd_stats failure 141/head
authorBoris Ranto <branto@redhat.com>
Sat, 7 Oct 2017 09:28:09 +0000 (11:28 +0200)
committerBoris Ranto <branto@redhat.com>
Sat, 7 Oct 2017 09:28:12 +0000 (11:28 +0200)
We currently do not check that we were able to successfully fetch the
osd_stas for a given osd_id which can result in collectors being down
for a while. We should check that we were able to fetch them before we
actually try to update them.

Signed-off-by: Boris Ranto <branto@redhat.com>
collectors/osd.py

index 749d690c9aa8a000aaa3a582aacf8147c8276f94..88b4f2f4ebb0d25870b7e616bfab6a19891d2b10 100644 (file)
@@ -295,8 +295,12 @@ class OSDs(BaseCollector):
             if osd_type in OSDs.supported_object_stores:
 
                 osd_stats = self._fetch_osd_stats(osd_id, osd_type)
-                osd_device = self.osd[osd_id]
-                osd_device.update(osd_stats)
+                if osd_stats:
+                    osd_device = self.osd[osd_id]
+                    osd_device.update(osd_stats)
+                else:
+                    self.logger.warning("OSD stats for osd.{} not "
+                                        "available".format(osd_id))
 
             else:
                 self.logger.warning("Unknown OSD type encountered for "