2016-11-19 17:44:40 +02:00
|
|
|
import plugins.common
|
2016-10-23 01:53:02 +03:00
|
|
|
import psutil
|
|
|
|
|
|
|
|
|
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-10-23 01:53:02 +03:00
|
|
|
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
|
2016-10-23 01:53:02 +03:00
|
|
|
du_free = str(round(du_stat.free / 2**30, 2))
|
|
|
|
du = self.part + ': ' + du_free + 'G'
|
|
|
|
self.status['full_text'] = du
|