Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos.toolbox
Commits
e1b77dae
Commit
e1b77dae
authored
Jan 11, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check_free_disk_space: Btrfs has no fixed inode limit
This fixes division by 0.
parent
70293e95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
15 deletions
+10
-15
slapos/promise/plugin/check_free_disk_space.py
slapos/promise/plugin/check_free_disk_space.py
+10
-15
No files found.
slapos/promise/plugin/check_free_disk_space.py
View file @
e1b77dae
...
...
@@ -105,24 +105,19 @@ class RunPromise(GenericPromise):
self
.
logger
.
warn
(
"collector database is locked by another process"
)
return
False
def
getInodeUsage
(
self
,
path
):
max_inode_usage
=
97.99
# < 98% usage
@
staticmethod
def
_checkInodeUsage
(
path
):
stat
=
os
.
statvfs
(
path
)
usage_output
=
""
total_inode
=
stat
.
f_files
free_inode
=
stat
.
f_ffree
usage
=
round
(((
total_inode
-
free_inode
)
/
total_inode
),
4
)
*
100
if
usage
>
max_inode_usage
:
return
"Disk Inodes usages is really high: %s%%"
%
usage
elif
os
.
path
.
exists
(
'/tmp'
):
# check if /tmp is mounted on another disk than path
tmp_stat
=
os
.
statvfs
(
'/tmp'
)
if
tmp_stat
.
f_blocks
!=
stat
.
f_blocks
:
tmp_usage
=
round
(((
tmp_stat
.
f_files
-
tmp_stat
.
f_ffree
)
/
tmp_stat
.
f_files
),
4
)
*
100
if
tmp_usage
>
max_inode_usage
:
return
"Disk Inodes usage is high: %s%%"
%
tmp_usage
return
""
if
total_inode
:
usage
=
100
*
(
total_inode
-
stat
.
f_ffree
)
/
total_inode
if
usage
>=
98
:
return
"Disk Inodes usage is really high: %.4f%%"
%
usage
def
getInodeUsage
(
self
,
path
):
return
(
self
.
_checkInodeUsage
(
path
)
or
os
.
path
.
ismount
(
'/tmp'
)
and
self
.
_checkInodeUsage
(
'/tmp'
)
or
""
)
def
sense
(
self
):
# find if a disk is mounted on the path
...
...
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