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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos
Commits
f9853052
Commit
f9853052
authored
Jul 29, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
status.cgi.in +1
parent
a56108bf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
32 deletions
+28
-32
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+1
-1
stack/monitor/webfile-directory/status.cgi.in
stack/monitor/webfile-directory/status.cgi.in
+27
-31
No files found.
stack/monitor/buildout.cfg
View file @
f9853052
...
@@ -112,7 +112,7 @@ mode = 0644
...
@@ -112,7 +112,7 @@ mode = 0644
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
download-only = true
md5sum =
e43d79bec8824265e22df7960744113a
md5sum =
61c66c9e2e2da548bb03eee3982d09ed
destination = ${buildout:parts-directory}/monitor-template-status-cgi
destination = ${buildout:parts-directory}/monitor-template-status-cgi
filename = status.cgi.in
filename = status.cgi.in
mode = 0644
mode = 0644
...
...
stack/monitor/webfile-directory/status.cgi.in
View file @
f9853052
...
@@ -18,40 +18,36 @@ json_file = "{{ json_file }}"
...
@@ -18,40 +18,36 @@ json_file = "{{ json_file }}"
if not os.path.exists(json_file) or "refresh" in form:
if not os.path.exists(json_file) or "refresh" in form:
refresh()
refresh()
if not os.path.exists(json_file):
result = None
print """
<html><head>
if os.path.exists(json_file):
result = json.load(open(json_file))
if result is None or not result.keys():
print("""
<html><head>
<link
rel=
"stylesheet"
href=
"static/pure-min.css"
>
<link
rel=
"stylesheet"
href=
"static/pure-min.css"
>
<link
rel=
"stylesheet"
href=
"static/style.css"
>
<link
rel=
"stylesheet"
href=
"static/style.css"
>
</head><body>
</head><body>
<h1>
Monitoring :
</h1>
<h1>
Monitoring:
</h1>
No status file found
</p></body></html>
"""
<p>
Nothing to monitor
</p>
</body></html>
""")
exit(0)
exit(0)
result = json.load(open(json_file))
print("""
<html><head>
<link
rel=
"stylesheet"
href=
"static/pure-min.css"
>
print "
<html><head>
"
<link
rel=
"stylesheet"
href=
"static/style.css"
>
print "
<link
rel=
\"stylesheet\"
href=
\"static/pure-min.css\"
>
"
</head><body>
print "
<link
rel=
\"stylesheet\"
href=
\"static/style.css\"
>
"
<h1>
Monitoring:
</h1>
print "
</head><body>
"
<form
action=
"/index.cgi"
method=
"post"
class=
"pure-form-aligned"
>
print "
<h1>
Monitoring :
</h1>
"
<input
type=
"hidden"
name=
"posting-script"
value=
"{{ pwd }}/{{ this_file }}"
>
print "
<form
action=
\"/index.cgi\"
method=
\"post\"
class=
\"pure-form-aligned\"
>
"
<p><em>
Last time of monitoring process : %(datetime)s
</em></p>
"
print "
<input
type=
\"hidden\"
name=
\"posting-script\"
value=
\"{{
pwd
}}/{{
this_file
}}\"
>
"
<div
class=
"pure-controls"
>
print "
<p><em>
Last time of monitoring process : %s
</em></p>
" % (result['datetime'])
<button
type=
"submit"
class=
"pure-button pure-button-primary"
name=
"refresh"
value=
"refresh"
>
Refresh
</button>
</div>
</form><br/>
""" % {"datetime": cgi.escape(result['datetime'])})
del result['datetime']
del result['datetime']
print "
<div
class=
\"pure-controls\"
><button
type=
\"submit\"
class=
\"pure-button
\
pure-button-primary
\"
name=
\"refresh\"
value=
\"refresh\"
>
Refresh
</button></div></form>
"
print("
<ul>
")
print "
<br/>
"
for title in result:
print("
<li><span>
%(title)s
</span><span>
%(color)s
</span>
" % {"title": cgi.escape(title), "color": "red" if result[title] else "green"} )
print "
<h2>
These scripts and promises have failed :
</h2>
"
print("
</ul>
")
for r in result:
print("
</body></html>
")
if result[r] != '':
print "
<h3>
%s
</h3><pre
style=
\"padding-left:30px;\"
>
%s
</pre>
" % (cgi.escape(r), cgi.escape(result[r]))
print "
<br/>
"
print "
<h2>
These scripts and promises were successful :
</h2>
"
print "
<ul>
"
for r in result:
if result[r] == '':
print "
<li>
%s
</li>
" % (r)
print "
</ul>
"
print "
</body></html>
"
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