Merge pull request #40 from jorio/mem-standard-formatting
mem: allow standard float formatting syntax
This commit is contained in:
commit
a1e87c607c
@ -542,7 +542,6 @@ Settings:
|
|||||||
:color: standard color (default: ``#00FF00``)
|
:color: standard color (default: ``#00FF00``)
|
||||||
:warn_color: defines the color used wann warn percentage ist exceeded (default: ``#FFFF00``)
|
:warn_color: defines the color used wann warn percentage ist exceeded (default: ``#FFFF00``)
|
||||||
:alert_color: defines the color used when alert percentage is exceeded (default: ``#FF0000``)
|
:alert_color: defines the color used when alert percentage is exceeded (default: ``#FF0000``)
|
||||||
:round: round byte values to given length behind dot
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ class Mem(IntervalModule):
|
|||||||
alert_color = "#FF0000"
|
alert_color = "#FF0000"
|
||||||
warn_percentage = 50
|
warn_percentage = 50
|
||||||
alert_percentage = 80
|
alert_percentage = 80
|
||||||
_round = 2
|
|
||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
("format", "format string used for output."),
|
("format", "format string used for output."),
|
||||||
@ -36,7 +35,6 @@ class Mem(IntervalModule):
|
|||||||
"defines the color used wann warn percentage ist exceeded"),
|
"defines the color used wann warn percentage ist exceeded"),
|
||||||
("alert_color",
|
("alert_color",
|
||||||
"defines the color used when alert percentage is exceeded"),
|
"defines the color used when alert percentage is exceeded"),
|
||||||
("round", "round byte values to given length behind dot")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -53,10 +51,9 @@ class Mem(IntervalModule):
|
|||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(
|
"full_text": self.format.format(
|
||||||
used_mem=round(used / self.divisor, self._round),
|
used_mem=used / self.divisor,
|
||||||
avail_mem=round(memory_usage.available / self.divisor,
|
avail_mem=memory_usage.available / self.divisor,
|
||||||
self._round),
|
total_mem=memory_usage.total / self.divisor,
|
||||||
total_mem=round(memory_usage.total / self.divisor, self._round),
|
percent_used_mem=memory_usage.percent),
|
||||||
percent_used_mem=int(memory_usage.percent)),
|
|
||||||
"color":color
|
"color":color
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user