vdstatus/plugins/disk.py

21 lines
665 B
Python
Raw Normal View History

import plugins.common
import psutil
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
super(PluginThread, self).__init__(section, config)
self.part = config.get(section, 'part')
def main(self):
du_stat = psutil.disk_usage(self.part)
2016-10-31 14:10:30 +02:00
if du_stat.percent >= self.problem_value:
self.hide = False
self.status['urgent'] = True
else:
self.hide = True
self.status['urgent'] = False
du_free = str(round(du_stat.free / 2**30, 2))
du = self.part + ': ' + du_free + 'G'
self.status['full_text'] = du