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
Nicolas Wavrant
slapos.toolbox
Commits
cffae9cb
Commit
cffae9cb
authored
Feb 21, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: run command with low priority using nice
parent
d1bd058e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
slapos/monitor/monitor.py
slapos/monitor/monitor.py
+10
-2
No files found.
slapos/monitor/monitor.py
View file @
cffae9cb
...
...
@@ -96,6 +96,8 @@ class Monitoring(object):
"monitor-promise-folder"
)
self
.
promise_timeout_file
=
softConfigGet
(
config
,
"monitor"
,
"promises-timeout-file"
)
self
.
nice_command
=
softConfigGet
(
config
,
"monitor"
,
"nice-cmd"
)
self
.
config_folder
=
os
.
path
.
join
(
self
.
private_folder
,
'config'
)
self
.
report_folder
=
self
.
private_folder
...
...
@@ -103,6 +105,9 @@ class Monitoring(object):
self
.
promise_output_file
=
config
.
get
(
"monitor"
,
"promise-output-file"
)
self
.
bootstrap_is_ok
=
True
if
self
.
nice_command
:
# run monitor promises script with low priority
self
.
promise_runner
=
'%s %s'
%
(
self
.
nice_command
,
self
.
promise_runner
)
def
loadConfig
(
self
,
pathes
,
config
=
None
):
if
config
is
None
:
...
...
@@ -408,7 +413,7 @@ class Monitoring(object):
promise_cmd_line
=
[
"* * * * *"
,
"sleep $((1 + RANDOM %
30)) &&"
,
# Sleep between 1 to 3
0 seconds
"sleep $((1 + RANDOM %
20)) &&"
,
# Sleep between 1 to 2
0 seconds
self
.
promise_runner
,
'--pid_path "%s"'
%
os
.
path
.
join
(
self
.
service_pid_folder
,
"monitor-promises.pid"
),
...
...
@@ -497,7 +502,10 @@ class Monitoring(object):
# Add cron entry for SlapOS Collect
command
=
"sleep $((1 + RANDOM % 60)) && "
# Random sleep between 1 to 60 seconds
command
+=
"%s %s --output_folder %s --collector_db %s"
%
(
self
.
python
,
if
self
.
nice_command
:
# run monitor collect with low priority
command
+=
'%s '
%
self
.
nice_command
command
+=
"%s --output_folder %s --collector_db %s"
%
(
self
.
collect_script
,
self
.
data_folder
,
self
.
collector_db
)
self
.
addCronEntry
(
'monitor_collect'
,
'* * * * *'
,
command
)
...
...
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