mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
tighten the status text strings for free memory, add changelog entry
This commit is contained in:
parent
59f8aa1c31
commit
a9cd72bbf9
@ -1,6 +1,10 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
Control Panel:
|
||||
|
||||
* Report free memory usage.
|
||||
|
||||
Still In Development
|
||||
--------------------
|
||||
|
||||
|
@ -206,24 +206,17 @@ def check_free_disk_space(rounded_values, env, output):
|
||||
|
||||
def check_free_memory(rounded_values, env, output):
|
||||
# Check free memory.
|
||||
percent_used = psutil.virtual_memory().percent
|
||||
percent_left = 100 - percent_used
|
||||
if not rounded_values:
|
||||
memory_msg = "The system has allocated %s%% of the memory." % str(round(percent_used))
|
||||
if percent_left > 20:
|
||||
percent_free = 100 - psutil.virtual_memory().percent
|
||||
memory_msg = "System memory is %s%% free." % str(round(percent_free))
|
||||
if percent_free >= 30:
|
||||
if rounded_values: memory_msg = "System free memory is at least 30%."
|
||||
output.print_ok(memory_msg)
|
||||
elif percent_left > 15:
|
||||
elif percent_free >= 15:
|
||||
if rounded_values: memory_msg = "System free memory is below 30%."
|
||||
output.print_warning(memory_msg)
|
||||
else:
|
||||
if rounded_values: memory_msg = "System free memory is below 15%."
|
||||
output.print_error(memory_msg)
|
||||
else:
|
||||
memory_msg = "The system has less than %s%% memory left." % str(round(percent_left))
|
||||
if percent_left > 20:
|
||||
output.print_ok("The system has more than 20% memory left")
|
||||
elif percent_left > 15:
|
||||
output.print_warning("The system has less than 20% memory left but more than 15%")
|
||||
else:
|
||||
output.print_error("The system has less than 15% memory left")
|
||||
|
||||
def run_network_checks(env, output):
|
||||
# Also see setup/network-checks.sh.
|
||||
|
Loading…
Reference in New Issue
Block a user