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
Lisa Casino
slapos.toolbox
Commits
8739a96e
Commit
8739a96e
authored
Aug 10, 2021
by
Lisa Casino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for test
parent
c4213291
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
slapos/promise/plugin/check_free_disk_space.py
slapos/promise/plugin/check_free_disk_space.py
+6
-0
slapos/promise/plugin/monitor_partition_space.py
slapos/promise/plugin/monitor_partition_space.py
+2
-0
No files found.
slapos/promise/plugin/check_free_disk_space.py
View file @
8739a96e
...
@@ -241,6 +241,7 @@ class RunPromise(GenericPromise):
...
@@ -241,6 +241,7 @@ class RunPromise(GenericPromise):
def
sense
(
self
):
def
sense
(
self
):
# find if a disk is mounted on the path
# find if a disk is mounted on the path
self
.
logger
.
info
(
"Debut"
)
disk_partition
=
""
disk_partition
=
""
db_path
=
self
.
getConfig
(
'collectordb'
)
db_path
=
self
.
getConfig
(
'collectordb'
)
check_date
=
self
.
getConfig
(
'test-check-date'
)
check_date
=
self
.
getConfig
(
'test-check-date'
)
...
@@ -274,6 +275,8 @@ class RunPromise(GenericPromise):
...
@@ -274,6 +275,8 @@ class RunPromise(GenericPromise):
currenttime
=
now
-
datetime
.
timedelta
(
minutes
=
1
)
currenttime
=
now
-
datetime
.
timedelta
(
minutes
=
1
)
currenttime
=
currenttime
.
time
().
strftime
(
'%H:%M'
)
currenttime
=
currenttime
.
time
().
strftime
(
'%H:%M'
)
self
.
logger
.
info
(
"Vérification du disk size va commencer"
)
disk_size
=
self
.
getDiskSize
(
disk_partition
,
db_path
)
disk_size
=
self
.
getDiskSize
(
disk_partition
,
db_path
)
default_threshold
=
None
default_threshold
=
None
if
disk_size
is
not
None
:
if
disk_size
is
not
None
:
...
@@ -283,6 +286,7 @@ class RunPromise(GenericPromise):
...
@@ -283,6 +286,7 @@ class RunPromise(GenericPromise):
free_space
=
self
.
getFreeSpace
(
disk_partition
,
db_path
,
currentdate
,
free_space
=
self
.
getFreeSpace
(
disk_partition
,
db_path
,
currentdate
,
currenttime
)
currenttime
)
self
.
logger
.
info
(
"Free space checked"
)
if
free_space
==
0
:
if
free_space
==
0
:
return
return
elif
free_space
>
threshold
*
1024
*
1024
*
1024
:
elif
free_space
>
threshold
*
1024
*
1024
*
1024
:
...
@@ -317,6 +321,8 @@ class RunPromise(GenericPromise):
...
@@ -317,6 +321,8 @@ class RunPromise(GenericPromise):
message
=
"Free disk space low: remaining %.2f G (disk size: %.2f G, threshold: %s G)."
%
(
message
=
"Free disk space low: remaining %.2f G (disk size: %.2f G, threshold: %s G)."
%
(
free_space
/
(
1024
*
1024
*
1024
),
disk_size
/
(
1024
*
1024
*
1024
),
threshold
)
free_space
/
(
1024
*
1024
*
1024
),
disk_size
/
(
1024
*
1024
*
1024
),
threshold
)
self
.
logger
.
info
(
"Peut-être va afficher les grosses partitions"
)
display_partition
=
bool
(
int
(
self
.
getConfig
(
'display-partition'
),
0
))
display_partition
=
bool
(
int
(
self
.
getConfig
(
'display-partition'
),
0
))
self
.
logger
.
info
(
"Enable to display the 3 biggest partitions: %s"
%
display_partition
)
self
.
logger
.
info
(
"Enable to display the 3 biggest partitions: %s"
%
display_partition
)
if
display_partition
:
if
display_partition
:
...
...
slapos/promise/plugin/monitor_partition_space.py
View file @
8739a96e
...
@@ -89,6 +89,8 @@ class RunPromise(GenericPromise):
...
@@ -89,6 +89,8 @@ class RunPromise(GenericPromise):
database
=
Database
(
db_path
,
create
=
False
,
timeout
=
10
)
database
=
Database
(
db_path
,
create
=
False
,
timeout
=
10
)
try
:
try
:
disk_size
=
self
.
getDiskSize
(
disk_partition
,
db_path
)
disk_size
=
self
.
getDiskSize
(
disk_partition
,
db_path
)
if
disk_size
is
None
:
return
None
database
.
connect
()
database
.
connect
()
result
=
database
.
select
(
result
=
database
.
select
(
"folder"
,
"folder"
,
...
...
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