2016-10-23 01:53:02 +03:00
|
|
|
import os
|
2016-11-19 17:44:40 +02:00
|
|
|
import plugins.common
|
2016-10-23 01:53:02 +03:00
|
|
|
|
|
|
|
|
2016-11-19 17:44:40 +02:00
|
|
|
class PluginThread(plugins.common.PluginThreadCommon):
|
2016-10-23 01:53:02 +03:00
|
|
|
def __init__(self, section, config, thread_id):
|
2016-11-19 17:44:40 +02:00
|
|
|
super(PluginThread, self).__init__(section, config)
|
2016-11-03 17:59:00 +02:00
|
|
|
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=False)
|
2016-10-23 01:53:02 +03:00
|
|
|
|
|
|
|
def main(self):
|
|
|
|
loads = os.getloadavg()
|
2016-10-31 14:20:07 +02:00
|
|
|
if loads[0] >= self.problem_value:
|
|
|
|
self.hide = False
|
|
|
|
self.status['urgent'] = True
|
|
|
|
else:
|
2016-11-03 17:59:00 +02:00
|
|
|
self.hide = self.hide_ok
|
2016-10-31 14:20:07 +02:00
|
|
|
self.status['urgent'] = False
|
2016-10-23 01:53:02 +03:00
|
|
|
loads = [str(i) for i in loads]
|
|
|
|
self.status['full_text'] = 'LA: ' + ' '.join(loads)
|