Merge 6dcd9e6cab
into 8941f60572
This commit is contained in:
commit
7d173fc006
3 changed files with 9 additions and 3 deletions
|
@ -21,6 +21,8 @@ class Module(bumblebee.engine.Module):
|
|||
widget = bumblebee.output.Widget(full_text=self.utilization)
|
||||
widget.set("theme.minwidth", "99.9%")
|
||||
super(Module, self).__init__(engine, config, widget)
|
||||
self._warn_threshold = float(self.parameter("warning", 70))
|
||||
self._crit_threshold = float(self.parameter("critical", 80))
|
||||
self._utilization = psutil.cpu_percent(percpu=False)
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd="gnome-system-monitor")
|
||||
|
@ -32,6 +34,6 @@ class Module(bumblebee.engine.Module):
|
|||
self._utilization = psutil.cpu_percent(percpu=False)
|
||||
|
||||
def state(self, _):
|
||||
return self.threshold_state(self._utilization, 70, 80)
|
||||
return self.threshold_state(self._utilization, self._warn_threshold, self._crit_threshold)
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -24,6 +24,8 @@ class Module(bumblebee.engine.Module):
|
|||
self._cpus = multiprocessing.cpu_count()
|
||||
except NotImplementedError as e:
|
||||
self._cpus = 1
|
||||
self._warn_threshold = float(self.parameter("warning", 70)) / 100
|
||||
self._crit_threshold = float(self.parameter("critical", 80)) / 100
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd="gnome-system-monitor")
|
||||
|
||||
|
@ -36,6 +38,8 @@ class Module(bumblebee.engine.Module):
|
|||
self._load = os.getloadavg()
|
||||
|
||||
def state(self, widget):
|
||||
return self.threshold_state(self._load[0], self._cpus*0.7, self._cpus*0.8)
|
||||
warn = self._cpus * self._warn_threshold
|
||||
crit = self._cpus * self._crit_threshold
|
||||
return self.threshold_state(self._load[0], warn, crit)
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue