Merge pull request #58 from andresmrm/patch-1
configurable color and round parameters
This commit is contained in:
commit
e7fc0308a8
@ -18,6 +18,8 @@ class Disk(IntervalModule):
|
|||||||
("display_limit", "if more space is available than this limit the module is hidden"),
|
("display_limit", "if more space is available than this limit the module is hidden"),
|
||||||
("critical_limit", "critical space limit (see critical_color)"),
|
("critical_limit", "critical space limit (see critical_color)"),
|
||||||
("critical_color", "the critical color"),
|
("critical_color", "the critical color"),
|
||||||
|
("color", "the common color"),
|
||||||
|
("round_size", "precision, None for INT"),
|
||||||
)
|
)
|
||||||
required = ("path",)
|
required = ("path",)
|
||||||
color = "#FFFFFF"
|
color = "#FFFFFF"
|
||||||
@ -26,6 +28,8 @@ class Disk(IntervalModule):
|
|||||||
divisor = 1024 ** 3
|
divisor = 1024 ** 3
|
||||||
display_limit = float('Inf')
|
display_limit = float('Inf')
|
||||||
critical_limit = 0
|
critical_limit = 0
|
||||||
|
round_size = 2
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
stat = os.statvfs(self.path)
|
stat = os.statvfs(self.path)
|
||||||
@ -44,7 +48,7 @@ class Disk(IntervalModule):
|
|||||||
"percentage_avail": stat.f_bavail / stat.f_blocks * 100,
|
"percentage_avail": stat.f_bavail / stat.f_blocks * 100,
|
||||||
"percentage_used": (stat.f_blocks - stat.f_bfree) / stat.f_blocks * 100,
|
"percentage_used": (stat.f_blocks - stat.f_bfree) / stat.f_blocks * 100,
|
||||||
}
|
}
|
||||||
round_dict(cdict, 2)
|
round_dict(cdict, self.round_size)
|
||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(**cdict),
|
"full_text": self.format.format(**cdict),
|
||||||
|
Loading…
Reference in New Issue
Block a user