From: Michael Tremer Date: Thu, 24 Sep 2020 12:52:00 +0000 (+0000) Subject: disk: Refactor bad sectors graph X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60d1723eba0d9c397042b21b5594b9e1cc8c3950;p=telemetry.git disk: Refactor bad sectors graph Signed-off-by: Michael Tremer --- diff --git a/src/collecty/plugins/disk.py b/src/collecty/plugins/disk.py index 3afd7e1..71ac02d 100644 --- a/src/collecty/plugins/disk.py +++ b/src/collecty/plugins/disk.py @@ -26,6 +26,7 @@ from .. import _collecty from . import base from ..colours import * +from ..constants import * class GraphTemplateDiskBadSectors(base.GraphTemplate): name = "disk-bad-sectors" @@ -35,19 +36,31 @@ class GraphTemplateDiskBadSectors(base.GraphTemplate): _ = self.locale.translate return [ - "AREA:bad_sectors%s:%s" % (COLOUR_CRITICAL,_("Bad Sectors")), - "GPRINT:bad_sectors_cur:%12s\:" % _("Current") + " %9.2lf", - "GPRINT:bad_sectors_max:%12s\:" % _("Maximum") + " %9.2lf", + "COMMENT:%s" % EMPTY_LABEL, + "COMMENT:%s" % (COLUMN % _("Current")), + "COMMENT:%s\\j" % (COLUMN % _("Maximum")), + + "AREA:bad_sectors%s:%s" % ( + transparency(COLOUR_CRITICAL, AREA_OPACITY), + LABEL % _("Bad Sectors"), + ), + "GPRINT:bad_sectors_cur:%s" % INTEGER, + "GPRINT:bad_sectors_max:%s\\j" % INTEGER, + + # Contour line + "LINE:bad_sectors%s" % COLOUR_CRITICAL, ] @property def graph_title(self): _ = self.locale.translate + return _("Bad Sectors of %s") % self.object.device_string @property def graph_vertical_label(self): _ = self.locale.translate + return _("Pending/Relocated Sectors")