Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Lu Xu
slapos
Commits
914ff766
Commit
914ff766
authored
Feb 22, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: use nice to run commands with low priority, update README and free disk promise message
parent
ce2accc8
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
145 additions
and
28 deletions
+145
-28
stack/monitor/README.md
stack/monitor/README.md
+129
-21
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+2
-2
stack/monitor/instance-monitor.cfg.jinja2.in
stack/monitor/instance-monitor.cfg.jinja2.in
+11
-2
stack/monitor/templates/check_free_disk.in
stack/monitor/templates/check_free_disk.in
+3
-3
No files found.
stack/monitor/README.md
View file @
914ff766
This diff is collapsed.
Click to expand it.
stack/monitor/buildout.cfg
View file @
914ff766
...
...
@@ -89,7 +89,7 @@ md5sum = 683ea85fc054094248baf5752dd089bf
[monitor-check-free-disk-space]
<= monitor-template-base
filename = check_free_disk.in
md5sum =
bc61a77f8c06615dfa687ed48893bbc1
md5sum =
e48f3804dc367e51a70063ab0e589e9e
# End templates files
# XXX keep compatibility (with software/ipython_notebook/software.cfg )
...
...
@@ -102,7 +102,7 @@ recipe = slapos.recipe.template:jinja2
filename = template-monitor.cfg
template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in
rendered = ${buildout:directory}/template-monitor.cfg
md5sum =
be07297494e08377c4dfecb26c2919ef
md5sum =
2c2aacb9fa97e35818bfa4543dffcb5a
context =
key apache_location apache:location
key gzip_location gzip:location
...
...
stack/monitor/instance-monitor.cfg.jinja2.in
View file @
914ff766
...
...
@@ -102,13 +102,14 @@ parameter-list =
raw monitor-user ${monitor-instance-parameter:username}
htpasswd monitor-password ${monitor-htpassword-file:password-file} ${monitor-instance-parameter:username} ${httpd-monitor-htpasswd:htpasswd-path}
file promise-timeout ${monitor-promise-timeout-file:file}
file
free-disk-space
-MB ${promise-check-free-disk-space:config-file}
file
min-free-disk
-MB ${promise-check-free-disk-space:config-file}
${monitor-instance-parameter:instance-configuration}
# htpasswd entry: htpasswd key password-file username htpasswd-file
collector-db = ${monitor-instance-parameter:collector-db}
collect-script = {{ monitor_collect }}
python = {{ python_with_eggs }}
nice-cmd = ${xnice-bin:output}
promise-output-file = ${directory:monitor}/monitor-bootstrap-status
...
...
@@ -230,9 +231,17 @@ context =
raw dash_binary {{ dash_executable_location }}
command = kill -USR1 $(cat ${monitor-httpd-conf-parameter:pid-file})
[xnice-bin]
recipe = collective.recipe.template
input = inline:#!/bin/sh
# run something at lowest possible priority
exec nice -19 chrt --idle 0 ionice -c3 "$@"
output = ${directory:bin}/xnice
mode = 700
[monitor-globalstate-wrapper]
recipe = slapos.cookbook:wrapper
command-line = {{ monitor_genstatus }} '${monitor-conf:rendered}' '${monitor-instance-info:rendered}'
command-line =
${xnice-bin:output}
{{ monitor_genstatus }} '${monitor-conf:rendered}' '${monitor-instance-info:rendered}'
wrapper-path = ${directory:bin}/monitor-globalstate
[monitor-configurator-wrapper]
...
...
stack/monitor/templates/check_free_disk.in
View file @
914ff766
...
...
@@ -34,10 +34,10 @@ if __name__ == '__main__':
value = int(min_size_str)
if value >= 200:
# Minimum value is 200Mb, it's already low
min_free_size = int(min_size_str)*1024
min_free_size = int(min_size_str)*1024
*1024
else:
with open(config_file, 'w') as f:
f.write(str(min_free_size/
1024
))
f.write(str(min_free_size/
(1024*1024)
))
real_free_space = user_free_space(home_path)
if real_free_space > min_free_size:
print "Free disk space: OK"
...
...
@@ -45,7 +45,7 @@ if __name__ == '__main__':
real_space_g = round(real_free_space/(1024.0*1024*1024), 2)
min_space_g = round(min_free_size/(1024.0*1024*1024), 2)
print 'Free disk space
slow: remaning %s G, min is %s G
' % (
print 'Free disk space
low: remaning %s G (threshold: %s G)
' % (
real_space_g, min_space_g)
print 'You can modify minimum value on your monitor interface.'
exit(1)
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