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
Lisa Casino
slapos
Commits
3422b8fa
Commit
3422b8fa
authored
Jun 17, 2014
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into erp5-component
parents
4aa021e0
e2f33e64
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
227 additions
and
40 deletions
+227
-40
software/apache-frontend/common.cfg
software/apache-frontend/common.cfg
+1
-1
software/apache-frontend/instance-apache-frontend.cfg
software/apache-frontend/instance-apache-frontend.cfg
+12
-0
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+29
-12
stack/monitor/monitor.cfg.in
stack/monitor/monitor.cfg.in
+16
-7
stack/monitor/webfile-directory/index.cgi.in
stack/monitor/webfile-directory/index.cgi.in
+2
-2
stack/monitor/webfile-directory/index.html.jinja2
stack/monitor/webfile-directory/index.html.jinja2
+4
-4
stack/monitor/webfile-directory/monitor-password.cgi.in
stack/monitor/webfile-directory/monitor-password.cgi.in
+4
-4
stack/monitor/webfile-directory/settings.cgi.in
stack/monitor/webfile-directory/settings.cgi.in
+6
-6
stack/monitor/webfile-directory/static/monitor-register.js
stack/monitor/webfile-directory/static/monitor-register.js
+17
-0
stack/monitor/webfile-directory/static/pure-min.css
stack/monitor/webfile-directory/static/pure-min.css
+11
-0
stack/monitor/webfile-directory/static/script.js
stack/monitor/webfile-directory/static/script.js
+35
-0
stack/monitor/webfile-directory/static/style.css
stack/monitor/webfile-directory/static/style.css
+31
-0
stack/monitor/webfile-directory/static/welcome.html
stack/monitor/webfile-directory/static/welcome.html
+11
-0
stack/monitor/webfile-directory/status-history.cgi.in
stack/monitor/webfile-directory/status-history.cgi.in
+44
-0
stack/monitor/webfile-directory/status.cgi.in
stack/monitor/webfile-directory/status.cgi.in
+4
-4
No files found.
software/apache-frontend/common.cfg
View file @
3422b8fa
...
...
@@ -67,7 +67,7 @@ mode = 0644
[template-apache-frontend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-frontend.cfg
md5sum =
b823cb31ff97700c009cf14725690323
md5sum =
070275aa2b2941702cc9ec637fe778e1
output = ${buildout:directory}/template-apache-frontend.cfg
mode = 0644
...
...
software/apache-frontend/instance-apache-frontend.cfg
View file @
3422b8fa
...
...
@@ -39,6 +39,7 @@ parts =
deploy-index
deploy-settings-cgi
deploy-status-cgi
deploy-status-history-cgi
setup-static-files
certificate-authority
zero-parameters
...
...
@@ -52,6 +53,7 @@ parts =
monitor-backup-log-access
monitor-ats-cache-stats-wrapper
monitor-apache-configuration-verification
monitor-verify-re6st-connectivity
extends = ${monitor-template:output}
...
...
@@ -629,3 +631,13 @@ mode = 0700
command = echo "<pre>$($${apache-configuration:frontend-configuration-verification})</pre>"
extra-context =
key content :command
[monitor-verify-re6st-connectivity]
recipe = slapos.cookbook:check_url_available
path = $${monitor-directory:monitor-custom-scripts}/re6st-connectivity
url = $${public:re6st-verification-url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
[public]
re6st-verification-url = http://[2001:67c:1254:4::1]/index.html
stack/monitor/buildout.cfg
View file @
3422b8fa
...
...
@@ -10,7 +10,6 @@ extends =
parts =
slapos-cookbook
dcron
download-static-files
monitor-eggs
extra-eggs
monitor-bin
...
...
@@ -42,7 +41,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/monitor.cfg.in
output = ${buildout:directory}/monitor.cfg
filename = monitor.cfg
md5sum =
499ba647f0c22f16bea3cc88bdfd98e8
md5sum =
0fe5b78cd16df190ec8838116954669e
mode = 0644
[monitor-bin]
...
...
@@ -58,7 +57,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum =
cd649264b331499241abfcdb4e81672a
md5sum =
af1adc107b73290afb98d011f7307de1
destination = ${buildout:directory}/parts/monitor-index
filename = index.cgi.in
mode = 0644
...
...
@@ -68,7 +67,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
destination = ${buildout:directory}/parts/monitor-template-index
md5sum =
e0d2aaeffc046b2ac6d9d717e1ba321d
md5sum =
05051a2ff81ce7dc2eef3106d75b33f9
filename = index.html.jinja2
mode = 0644
...
...
@@ -76,16 +75,25 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum =
4fb26753ee669b8ac90ffe33dbd12e8f
md5sum =
e43d79bec8824265e22df7960744113a
destination = ${buildout:directory}/parts/monitor-template-status-cgi
filename = status.cgi.in
mode = 0644
[status-history-cgi]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum = fa8ec5aa5395b1bc6b9c7e898d6c5ec5
destination = ${buildout:directory}/parts/monitor-template-status-history-cgi
filename = status-history.cgi.in
mode = 0644
[settings-cgi]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum =
f19c8e4b94718d475520618ae57338c
8
md5sum =
b4cef123a3273e848e8fe496e22b20a
8
destination = ${buildout:directory}/parts/monitor-template-settings-cgi
filename = settings.cgi.in
mode = 0644
...
...
@@ -94,7 +102,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum =
1a6153908934bf77e3e033eeabdc1675
md5sum =
c7ba7ecb09d0d1d24e7cb73a212cc33f
destination = ${buildout:directory}/parts/monitor-template-monitor-password-cgi
filename = monitor-password.cgi.in
mode = 0644
...
...
@@ -115,11 +123,20 @@ output = $${directory:services}/crond
mode = 0700
logfile = $${directory:log}/crond.log
[download-
static-files
]
[download-
monitor-static
]
recipe = hexagonit.recipe.download
url = https://github.com/SlapOS/staticForMonitoring/blob/8b7050faa2dd22592766e25b66b9efe0d0b216c9/static-files.tar.gz?raw=true
download-only = true
md5sum = 05030ff31dc75c2b96559dedc70945f5
filename = static-files.tar.gz
url = http://git.erp5.org/gitweb/slapos.git/snapshot/930be99041ea26b7b1186830e5eb56ef0acc1bdf.tar.gz
download-only = false
filename = monitor-static.tar.gz
destination = ${buildout:directory}/parts/monitor-static-files
ignore-existing = true
strip-top-level-dir = true
mode = 0644
[download-monitor-jquery]
recipe = hexagonit.recipe.download
url = http://code.jquery.com/jquery-1.10.2.min.js
download-only = true
destination = ${download-monitor-static:destination}
filename = jquery-1.10.2.min.js
mode = 0644
stack/monitor/monitor.cfg.in
View file @
3422b8fa
...
...
@@ -87,12 +87,9 @@ frequency = */5 * * * *
command = $${make-rss:rendered}
[setup-static-files]
recipe = hexagonit.recipe.download
url = ${download-static-files:destination}/${download-static-files:filename}
filename = static
destination = $${monitor-directory:www}
ignore-existing = true
mode = 0644
recipe = plone.recipe.command
command = ln -s ${download-monitor-jquery:destination} $${monitor-directory:www}/static
update-command = $${:command}
[deploy-index]
recipe = slapos.recipe.template:jinja2
...
...
@@ -107,7 +104,7 @@ context =
key monitor_password_script_path deploy-monitor-password-cgi:rendered
key apache_update_command :update-apache-access
raw extra_eggs_interpreter ${buildout:directory}/bin/${extra-eggs:interpreter}
raw default_page /welcome.html
raw default_page /
static/
welcome.html
[deploy-index-template]
recipe = hexagonit.recipe.download
...
...
@@ -130,6 +127,17 @@ context =
key this_file :filename
raw python_executable ${buildout:executable}
[deploy-status-history-cgi]
recipe = slapos.recipe.template:jinja2
template = ${status-history-cgi:location}/${status-history-cgi:filename}
rendered = $${monitor-directory:monitoring-cgi}/$${:filename}
filename = status-history.cgi
mode = 0744
context =
key monitor_db_path monitor-parameters:db-path
key status_history_length zero-parameters:status-history-length
raw python_executable ${buildout:executable}
[deploy-settings-cgi]
recipe = slapos.recipe.template:jinja2
template = ${settings-cgi:location}/${settings-cgi:filename}
...
...
@@ -220,6 +228,7 @@ name = example.com
[public]
recipe = slapos.cookbook:zero-knowledge.write
filename = knowledge0.cfg
status-history-length = 5
[zero-parameters]
recipe = slapos.cookbook:zero-knowledge.read
...
...
stack/monitor/webfile-directory/index.cgi.in
View file @
3422b8fa
...
...
@@ -161,8 +161,8 @@ if not is_password_set():
elif not check_password(password):
print "
<html><head>
"
print """
<link
rel=
"stylesheet"
href=
"pure-min.css"
>
<link
rel=
"stylesheet"
href=
"/style.css"
>
"""
<link
rel=
"stylesheet"
href=
"
static/
pure-min.css"
>
<link
rel=
"stylesheet"
href=
"
static
/style.css"
>
"""
print "
</head><body>
"
if password is None:
print "
<h1>
This is the monitoring interface
</h1>
"
...
...
stack/monitor/webfile-directory/index.html.jinja2
View file @
3422b8fa
<html>
<head>
<title>
Monitoring Interface
</title>
<link
rel=
"stylesheet"
href=
"pure-min.css"
>
<link
rel=
"stylesheet"
href=
"/style.css"
>
<script
src=
"jquery-1.10.2.min.js"
></script>
<script
src=
"script.js"
></script>
<link
rel=
"stylesheet"
href=
"
static/
pure-min.css"
>
<link
rel=
"stylesheet"
href=
"
static
/style.css"
>
<script
src=
"
static/
jquery-1.10.2.min.js"
></script>
<script
src=
"s
tatic/s
cript.js"
></script>
</head>
<body>
<div
id=
"div-menu"
>
...
...
stack/monitor/webfile-directory/monitor-password.cgi.in
View file @
3422b8fa
...
...
@@ -6,9 +6,9 @@ cgitb.enable()
print "
<html><head>
"
print """
<script
type=
"text/javascript"
src=
"/jquery-1.10.2.min.js"
></script>
<link
rel=
"stylesheet"
href=
"pure-min.css"
>
<link
rel=
"stylesheet"
href=
"/style.css"
>
"""
<script
type=
"text/javascript"
src=
"
static
/jquery-1.10.2.min.js"
></script>
<link
rel=
"stylesheet"
href=
"
static/
pure-min.css"
>
<link
rel=
"stylesheet"
href=
"
static
/style.css"
>
"""
print "
</head><body>
"
print "
<h1>
This is the monitoring interface
</h1>
"
print "
<h2>
Please set your password for later access
</h2>
"
...
...
@@ -24,6 +24,6 @@ print """
<div
class=
"pure-controls"
>
<button
id=
"register-button"
type=
"submit"
class=
"pure-button pure-button-primary"
disabled
>
Access
</button></div>
</form>
<script
type=
"text/javascript"
src=
"monitor-register.js"
></script>
<script
type=
"text/javascript"
src=
"
static/
monitor-register.js"
></script>
</body></html>
"""
stack/monitor/webfile-directory/settings.cgi.in
View file @
3422b8fa
...
...
@@ -9,8 +9,8 @@ cgitb.enable()
form = cgi.FieldStorage()
print "
<html><head>
"
print "
<link
rel=
\"stylesheet\"
href=
\"pure-min.css\"
>
"
print "
<link
rel=
\"stylesheet\"
href=
\"/style.css\"
>
"
print "
<link
rel=
\"stylesheet\"
href=
\"
static/
pure-min.css\"
>
"
print "
<link
rel=
\"stylesheet\"
href=
\"
static
/style.css\"
>
"
print "
</head><body>
"
config_file = "{{ config_cfg }}"
...
...
@@ -44,8 +44,8 @@ print "<form action=\"/index.cgi\" method=\"post\" class=\"pure-form-aligned\">"
print "
<input
type=
\"hidden\"
name=
\"posting-script\"
value=
\"{{
pwd
}}/{{
this_file
}}\"
>
"
for option in parser.options("public"):
print "
<div
class=
\"pure-control-group\"
>
"
print "
<label
for=
\"%s\"
>
%s
</label>
"
%(option, option
)
print "
<input
type=
\"text\"
name=
\"%s\"
value=
\"%s\"
>
"
%(option, parser.get('public', option
))
print "
<label
for=
\"%s\"
>
%s
</label>
"
% (cgi.escape(option, quote=True), cgi.escape(option)
)
print "
<input
type=
\"text\"
name=
\"%s\"
value=
\"%s\"
>
"
% (cgi.escape(option, quote=True), cgi.escape(parser.get('public', option), quote=True
))
print "
</div>
"
print "
<div
class=
\"pure-controls\"
><button
type=
\"submit\"
class=
\"pure-button
\
pure-button-primary
\"
>
Save
</button></div></form>
"
...
...
@@ -56,8 +56,8 @@ for section in parser.sections():
if section != 'public':
for option in parser.options(section):
print "
<div
class=
\"pure-control-group\"
>
"
print "
<label
for=
\"%s\"
>
%s
</label>
"
%(option, option
)
print "
<input
type=
\"text\"
name=
\"%s\"
value=
\"%s\"
readonly
>
"
%(option, parser.get(section, option
))
print "
<label
for=
\"%s\"
>
%s
</label>
"
% (cgi.escape(option, quote=True), cgi.escape(option)
)
print "
<input
type=
\"text\"
name=
\"%s\"
value=
\"%s\"
readonly
>
"
%(cgi.escape(option, quote=True), cgi.escape(parser.get(section, option), quote=True
))
print "
</div>
"
print "
</form>
"
...
...
stack/monitor/webfile-directory/static/monitor-register.js
0 → 100644
View file @
3422b8fa
$
(
window
).
load
(
function
(){
$
(
document
).
ready
(
function
()
{
$
(
"
#password_2
"
).
keyup
(
validate
);
});
function
validate
()
{
var
password1
=
$
(
"
#password
"
).
val
();
var
password2
=
$
(
"
#password_2
"
).
val
();
if
(
password1
==
password2
)
{
$
(
"
#register-button
"
).
removeAttr
(
"
disabled
"
);
$
(
"
#validate-status
"
).
attr
(
"
style
"
,
"
display:none
"
);
}
else
{
$
(
"
#register-button
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
#validate-status
"
).
attr
(
"
style
"
,
""
).
text
(
"
Passwords do not match
"
);
}
}
});
\ No newline at end of file
stack/monitor/webfile-directory/static/pure-min.css
0 → 100644
View file @
3422b8fa
This diff is collapsed.
Click to expand it.
stack/monitor/webfile-directory/static/script.js
0 → 100644
View file @
3422b8fa
$
(
document
).
ready
(
function
()
{
function
doDataUrl
(
data
)
{
var
frame_content
=
document
.
getElementsByTagName
(
"
iframe
"
)[
0
].
contentWindow
;
var
b64
=
btoa
(
data
);
dataurl
=
'
data:text/html;base64,
'
+
b64
;
$
(
"
iframe
"
).
attr
(
'
src
'
,
dataurl
);
}
if
(
window
.
self
===
window
.
top
)
{
//not in an iframe
$
(
"
.script
"
).
click
(
function
(
e
)
{
e
.
preventDefault
();
var
message
=
$
(
this
).
attr
(
'
href
'
);
var
slash_pos
=
message
.
search
(
'
/
'
);
//let's differenciate kind of script called
if
(
slash_pos
===
-
1
||
slash_pos
===
0
)
{
url
=
message
;
}
else
{
url
=
'
/index.cgi
'
;
}
$
(
"
iframe
"
).
attr
(
'
src
'
,
url
+
'
?script=
'
+
encodeURIComponent
(
message
));
});
$
(
"
.link
"
).
click
(
function
(
e
)
{
e
.
preventDefault
();
var
url
=
$
(
this
).
attr
(
'
href
'
);
$
(
"
iframe
"
).
attr
(
'
src
'
,
url
);
});
}
else
{
//in an iframe
$
(
"
body
"
).
empty
();
}
});
stack/monitor/webfile-directory/static/style.css
0 → 100644
View file @
3422b8fa
body
{
padding
:
15px
;
}
.pure-menu
.pure-menu-heading
{
font-size
:
120%
;
}
#content
{
display
:
inline-block
;
min-width
:
72%
;
height
:
97%
;
margin-left
:
30px
;
}
#div-menu
{
display
:
inline-block
;
vertical-align
:
top
;
}
#div-menu
h1
{
text-align
:
center
;
}
iframe
{
width
:
100%
;
height
:
100%
;
margin
:
0px
;
padding
:
0px
;
border-style
:
none
;
}
stack/monitor/webfile-directory/static/welcome.html
0 → 100644
View file @
3422b8fa
<html>
<head>
<title>
Welcome to the Monitoring Interface
</title>
<link
rel=
"stylesheet"
href=
"pure-min.css"
>
<link
rel=
"stylesheet"
href=
"style.css"
>
</head>
<body>
<h1>
Welcome to your monitoring interface
</h1>
<p>
From this interface you can monitor, configure your instance
</p>
</body>
</html>
stack/monitor/webfile-directory/status-history.cgi.in
0 → 100644
View file @
3422b8fa
#!{{ python_executable }}
import cgi
import datetime
import os
import sqlite3
db_path = '{{ monitor_db_path }}'
status_history_length = '{{ status_history_length }}'
db = sqlite3.connect(db_path)
print """
<html><head>
<link
rel=
"stylesheet"
href=
"static/pure-min.css"
>
<link
rel=
"stylesheet"
href=
"static/style.css"
>
</head><body>
<h1>
Monitor Status History :
</h1>
"""
def get_date_from_timestamp(timestamp):
return datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
def print_individual_status(timestamp):
print "
<div><h3>
Failure on %s
</h3><ul>
" % get_date_from_timestamp(timestamp)
rows = db.execute("select status, element, output from individual_status where timestamp=?", (timestamp,))
for row in rows:
status, element, output = row
print "
<li>
%s , %s :
</br><pre>
%s
</pre></li>
" % (status, cgi.escape(element), cgi.escape(output))
print "
</ul></div>
"
if not os.path.exists(db_path):
print """No status history found
</p></body></html>
"""
exit(0)
failure_row_list = db.execute("select timestamp from status where status='FAILURE' order by timestamp desc limit ?", status_history_length )
for failure_row in failure_row_list:
timestamp, = failure_row
print_individual_status(timestamp)
print "
</body></html>
"
stack/monitor/webfile-directory/status.cgi.in
View file @
3422b8fa
...
...
@@ -20,8 +20,8 @@ if not os.path.exists(json_file) or "refresh" in form:
if not os.path.exists(json_file):
print """
<html><head>
<link
rel=
"stylesheet"
href=
"pure-min.css"
>
<link
rel=
"stylesheet"
href=
"/style.css"
>
<link
rel=
"stylesheet"
href=
"
static/
pure-min.css"
>
<link
rel=
"stylesheet"
href=
"
static
/style.css"
>
</head><body>
<h1>
Monitoring :
</h1>
No status file found
</p></body></html>
"""
...
...
@@ -30,8 +30,8 @@ if not os.path.exists(json_file):
result = json.load(open(json_file))
print "
<html><head>
"
print "
<link
rel=
\"stylesheet\"
href=
\"pure-min.css\"
>
"
print "
<link
rel=
\"stylesheet\"
href=
\"/style.css\"
>
"
print "
<link
rel=
\"stylesheet\"
href=
\"
static/
pure-min.css\"
>
"
print "
<link
rel=
\"stylesheet\"
href=
\"
static
/style.css\"
>
"
print "
</head><body>
"
print "
<h1>
Monitoring :
</h1>
"
print "
<form
action=
\"/index.cgi\"
method=
\"post\"
class=
\"pure-form-aligned\"
>
"
...
...
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