Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
00bd23eb
Commit
00bd23eb
authored
Sep 15, 2016
by
cs@twoflower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix status_checks.py free disk space reporting #932
parent
d73d1c69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
status_checks.py
management/status_checks.py
+6
-6
No files found.
management/status_checks.py
View file @
00bd23eb
...
@@ -229,15 +229,15 @@ def check_free_disk_space(rounded_values, env, output):
...
@@ -229,15 +229,15 @@ def check_free_disk_space(rounded_values, env, output):
st
=
os
.
statvfs
(
env
[
'STORAGE_ROOT'
])
st
=
os
.
statvfs
(
env
[
'STORAGE_ROOT'
])
bytes_total
=
st
.
f_blocks
*
st
.
f_frsize
bytes_total
=
st
.
f_blocks
*
st
.
f_frsize
bytes_free
=
st
.
f_bavail
*
st
.
f_frsize
bytes_free
=
st
.
f_bavail
*
st
.
f_frsize
if
not
rounded_values
:
disk_msg
=
"The disk has
%.2
f GB space remaining."
%
(
bytes_free
/
1024.0
/
1024.0
/
1024.0
)
disk_msg
=
"The disk has
%
s GB space remaining."
%
str
(
round
(
bytes_free
/
1024.0
/
1024.0
/
1024.0
*
10.0
)
/
10
)
else
:
disk_msg
=
"The disk has less than
%
s
%%
space left."
%
str
(
round
(
bytes_free
/
bytes_total
/
10
+
.5
)
*
10
)
if
bytes_free
>
.3
*
bytes_total
:
if
bytes_free
>
.3
*
bytes_total
:
if
rounded_values
:
disk_msg
=
"The disk has more than 30
%
free space."
output
.
print_ok
(
disk_msg
)
output
.
print_ok
(
disk_msg
)
elif
bytes_free
>
.15
*
bytes_total
:
elif
bytes_free
>
.15
*
bytes_total
:
if
rounded_values
:
disk_msg
=
"The disk has less than 30
%
free space."
output
.
print_warning
(
disk_msg
)
output
.
print_warning
(
disk_msg
)
else
:
else
:
if
rounded_values
:
disk_msg
=
"The disk has less than 15
%
free space."
output
.
print_error
(
disk_msg
)
output
.
print_error
(
disk_msg
)
def
check_free_memory
(
rounded_values
,
env
,
output
):
def
check_free_memory
(
rounded_values
,
env
,
output
):
...
@@ -472,7 +472,7 @@ def check_dns_zone(domain, env, output, dns_zonefiles):
...
@@ -472,7 +472,7 @@ def check_dns_zone(domain, env, output, dns_zonefiles):
%
(
existing_ns
,
correct_ns
)
)
%
(
existing_ns
,
correct_ns
)
)
# Check that each custom secondary nameserver resolves the IP address.
# Check that each custom secondary nameserver resolves the IP address.
if
custom_secondary_ns
and
not
probably_external_dns
:
if
custom_secondary_ns
and
not
probably_external_dns
:
for
ns
in
custom_secondary_ns
:
for
ns
in
custom_secondary_ns
:
# We must first resolve the nameserver to an IP address so we can query it.
# We must first resolve the nameserver to an IP address so we can query it.
...
@@ -897,7 +897,7 @@ class FileOutput:
...
@@ -897,7 +897,7 @@ class FileOutput:
class
ConsoleOutput
(
FileOutput
):
class
ConsoleOutput
(
FileOutput
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
buf
=
sys
.
stdout
self
.
buf
=
sys
.
stdout
# Do nice line-wrapping according to the size of the terminal.
# Do nice line-wrapping according to the size of the terminal.
# The 'stty' program queries standard input for terminal information.
# The 'stty' program queries standard input for terminal information.
if
sys
.
stdin
.
isatty
():
if
sys
.
stdin
.
isatty
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment