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
iv
slapos
Commits
9fca331c
Commit
9fca331c
authored
Sep 22, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: handle promises by monitor
parent
cc32ff06
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
9 deletions
+17
-9
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+3
-3
stack/monitor/instance-monitor.cfg.jinja2.in
stack/monitor/instance-monitor.cfg.jinja2.in
+1
-0
stack/monitor/monitor.js.in
stack/monitor/monitor.js.in
+2
-4
stack/monitor/monitor.py.in
stack/monitor/monitor.py.in
+11
-2
No files found.
stack/monitor/buildout.cfg
View file @
9fca331c
...
...
@@ -56,7 +56,7 @@ md5sum = 2db5c08c7e8658981b4b1e3f27fd5967
[monitor-bin]
<= monitor-download-base
filename = monitor.py.in
md5sum =
1a376c4063121db33ffab25b4cd99c76
md5sum =
331e8579c390aba5c5f4a4e7820b4c03
[monitor-web-index-html]
<= monitor-download-base
...
...
@@ -71,7 +71,7 @@ md5sum = a18ab932e5e2e656995f47c7d4a7853a
[monitor-web-monitor-js]
<= monitor-download-base
filename = monitor.js.in
md5sum = 8
9ca4da3a1895014a052f114605ed527
md5sum = 8
bc4b8368a752f90da2571866768e81f
[monitor-web-monitor-logout-cgi]
<= monitor-download-base
...
...
@@ -89,7 +89,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 =
80527d09711810f74cfc2a8c2c9be880
md5sum =
1c731d879992c218bc6823e88c33f3b3
context =
key apache_location apache:location
key gzip_location gzip:location
...
...
stack/monitor/instance-monitor.cfg.jinja2.in
View file @
9fca331c
...
...
@@ -219,6 +219,7 @@ context =
key public_folder monitor-directory:public
key configuration_location monitor-conf:rendered
key promise_runner_path monitor-run-promise:rendered
key promise_folder directory:promises
[monitor-run-promise]
recipe = slapos.recipe.template:jinja2
...
...
stack/monitor/monitor.js.in
View file @
9fca331c
...
...
@@ -98,7 +98,7 @@
var interface_url = softGetProperty(service_dict, ["_links", "interface", "href"]),
status_url = softGetProperty(service_dict, ["_links", "status", "href"]),
href_html_part = (interface_url ? " href=\"" + escapeHtml(interface_url) + "\"" : ""),
title_html_part = (service_dict.title ? escapeHtml(service_dict.title) :
"Untitled"
),
title_html_part = (service_dict.title ? escapeHtml(service_dict.title) :
(service_dict.id ||"Untitled")
),
row = htmlToElementList("<table><tbody><tr><td><a" + href_html_part + ">" + title_html_part + "</a></td><td>Loading status...</td><td><a" + href_html_part + "><div style=\"height: 10mm; width: 10mm; background-color: gray;\"></div></a></td></tr></tbody></table>");
table.appendChild(row[2]);
if (!status_url) {
...
...
@@ -109,9 +109,7 @@
if (status_dict.description) {
row[2].title = status_dict.description;
}
if (status_dict.message) {
row[5].textContent = status_dict.message;
}
row[5].textContent = status_dict.message || "";
row[8].style.backgroundColor = status_dict.status === "OK" ? "green" : "red";
}).catch(function (reason) {
row[5].textContent = (reason && (reason.name + ": " + reason.message));
...
...
stack/monitor/monitor.py.in
View file @
9fca331c
...
...
@@ -2,6 +2,7 @@
configuration_location = "{{ configuration_location }}"
promise_runner_path = "{{ promise_runner_path }}"
public_folder = "{{ public_folder }}"
promise_folder = "{{ promise_folder }}"
import sys
import os
...
...
@@ -21,8 +22,16 @@ def main():
for filename in os.listdir(configuration_folder_location)
if os.path.isfile(os.path.join(configuration_folder_location, filename))
]
# search for promises in ...? or let promises be on some service conf files?
# XXX see old monitor.py.in
# search for promises in promise folder and convert into configuration
for filename in os.listdir(promise_folder):
path = os.path.join(promise_folder, filename)
if os.path.isfile(path):
c = ConfigParser.ConfigParser()
c.add_section("service")
c.set("service", "name", filename)
c.set("service", "frequency", "* * * * *") # every minutes
c.set("service", "promise-path", os.path.join(path))
service_config_list.append(c)
# generate monitor.json
monitor_dict = {}
tmp = softConfigGet(config, "monitor", "title")
...
...
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