vdstatus/plugins/load.py

20 lines
627 B
Python
Raw Normal View History

import os
import plugins.common
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=False)
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:
self.hide = self.hide_ok
2016-10-31 14:20:07 +02:00
self.status['urgent'] = False
loads = [str(i) for i in loads]
self.status['full_text'] = 'LA: ' + ' '.join(loads)