From: Paul Cuzner Date: Fri, 28 Jul 2017 08:02:45 +0000 (+1200) Subject: osd: add % used to each OSD X-Git-Tag: v1.0~38^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6876810d319c0a8aa483147c53c8362082d3dcd;p=cephmetrics.git osd: add % used to each OSD percent used was not available within the osd metric tree only the physical disk. With the inclusion under the osd, the percent_used can reference the osd_id directly easier in any queries --- diff --git a/collectors/osd.py b/collectors/osd.py index 79ed656..152e7b0 100644 --- a/collectors/osd.py +++ b/collectors/osd.py @@ -2,6 +2,7 @@ import os import time +import math from collectors.base import BaseCollector from collectors.common import (todict, fread, freadlines, merge_dicts, @@ -29,7 +30,7 @@ class OSDstats(object): self._current = {} self._previous = {} self._osd_type = osd_type - + self.osd_percent_used = 0 def update(self, stats): """ @@ -66,6 +67,8 @@ class OSDstats(object): for attr in stats['osd']: setattr(self, attr, stats['osd'].get(attr)) + self.osd_percent_used = math.ceil((float(self.stat_bytes_used) / + self.stat_bytes) * 100) class OSDs(BaseCollector):