vdstatus/plugins/load.py

20 lines
556 B
Python
Raw Normal View History

import os
import plugins
class PluginThread(plugins.PluginThreadCommon):
def __init__(self, config):
defaults = {'problem': 1}
super(PluginThread, self).__init__(config, defaults)
def main(self):
loads = os.getloadavg()
if loads[0] >= self.conf['problem']:
2016-10-31 14:20:07 +02:00
self.hide = False
self.status['urgent'] = True
else:
self.hide = True
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)