diff --git a/scripts/wk/cfg/hw.py b/scripts/wk/cfg/hw.py index c9bc28f0..0790cf63 100644 --- a/scripts/wk/cfg/hw.py +++ b/scripts/wk/cfg/hw.py @@ -172,6 +172,9 @@ TMUX_LAYOUT = OrderedDict({ 'badblocks': {'height': 5, 'Check': True}, 'I/O Benchmark': {'height': 1000, 'Check': False}, }) +# VOLUME THRESHOLDS in percent +VOLUME_WARNING_THRESHOLD = 70 +VOLUME_FAILURE_THRESHOLD = 85 if __name__ == '__main__': diff --git a/scripts/wk/os/linux.py b/scripts/wk/os/linux.py index 96fc4905..03023af7 100644 --- a/scripts/wk/os/linux.py +++ b/scripts/wk/os/linux.py @@ -7,9 +7,10 @@ import pathlib import re import subprocess -from wk.std import bytes_to_string, color_string +from wk.cfg.hw import VOLUME_FAILURE_THRESHOLD, VOLUME_WARNING_THRESHOLD from wk.exe import get_json_from_command, popen_program, run_program from wk.log import format_log_path +from wk.std import bytes_to_string, color_string # STATIC VARIABLES @@ -64,9 +65,9 @@ def build_volume_report(device_path=None) -> list: # Set size color if vol['fsused']: percent_used = (int(vol['fsused']) / int(vol['size'])) * 100 - if percent_used >= 85: + if percent_used >= VOLUME_FAILURE_THRESHOLD: size_color = 'RED' - elif percent_used >= 70: + elif percent_used >= VOLUME_WARNING_THRESHOLD: size_color = 'YELLOW' # Clean data