Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
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
Mynij
slapos-mynij-dev
Commits
0296b20a
Commit
0296b20a
authored
Dec 19, 2013
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stack-monitor: rss feed remembers previous records
parent
8098add8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
12 deletions
+28
-12
stack/monitor/make-rss.sh.in
stack/monitor/make-rss.sh.in
+4
-4
stack/monitor/monitor.cfg.in
stack/monitor/monitor.cfg.in
+14
-4
stack/monitor/monitor.py.in
stack/monitor/monitor.py.in
+6
-4
stack/monitor/nginx_rss.conf.in
stack/monitor/nginx_rss.conf.in
+4
-0
No files found.
stack/monitor/make-rss.sh.in
View file @
0296b20a
#!${dash-output:dash}
#!${dash-output:dash}
status=$${directory:monitor-result}/monitor.bool
STATUS=$${monitor-parameters:result-dir}
RSS_
DIR=$${directory:monitor-result
}
RSS_
FILE=$${monitor-parameters:rss-path
}
PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter}
PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter}
STATUS2RSS=${rss-bin:location}/${rss-bin:filename}
STATUS2RSS=${rss-bin:location}/${rss-bin:filename}
NAME=`basename $status`
NAME=`basename $STATUS`
cat $status | $PYTHON $STATUS2RSS "Backup status $NAME" "http://localhost/$NAME.rss" > $RSS_DIR/monitor.rss
cat $STATUS/* | $PYTHON $STATUS2RSS "Monitoring RSS feed" "http://[$${slap-parameters:ipv6-random}]/feed" > $RSS_FILE
\ No newline at end of file
\ No newline at end of file
stack/monitor/monitor.cfg.in
View file @
0296b20a
...
@@ -6,6 +6,14 @@ url = $${slap-connection:server-url}
...
@@ -6,6 +6,14 @@ url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
cert = $${slap-connection:cert-file}
[monitor-parameters]
monitor-dir = $${directory:monitor-result}
result-dir = $${:monitor-dir}/bool
json-filename = monitor.json
json-path = $${:monitor-dir}/$${:json-filename}
rss-path = $${directory:www}/monitor.html
executable = $${directory:bin}/monitor.py
[directory]
[directory]
home = $${buildout:directory}
home = $${buildout:directory}
etc = $${:home}/etc
etc = $${:home}/etc
...
@@ -20,6 +28,7 @@ cronstamps = $${:etc}/cronstamps
...
@@ -20,6 +28,7 @@ cronstamps = $${:etc}/cronstamps
log = $${:var}/log
log = $${:var}/log
monitor = $${:etc}/monitor
monitor = $${:etc}/monitor
monitor-result = $${:var}/monitor
monitor-result = $${:var}/monitor
monitor-result-bool = $${monitor-parameters:result-dir}
promise = $${:etc}/promise
promise = $${:etc}/promise
run = $${:var}/run
run = $${:var}/run
service = $${:etc}/service/
service = $${:etc}/service/
...
@@ -46,7 +55,7 @@ log = $${directory:log}/cron.log
...
@@ -46,7 +55,7 @@ log = $${directory:log}/cron.log
recipe = slapos.cookbook:cron.d
recipe = slapos.cookbook:cron.d
name = launch-monitor
name = launch-monitor
frequency = * * * * *
frequency = * * * * *
command = $${
deploy-monitor-script:rendered
} -a
command = $${
monitor-parameters:executable
} -a
[cron-entry-rss]
[cron-entry-rss]
<= cron
<= cron
...
@@ -58,12 +67,12 @@ command = $${make-rss:output}
...
@@ -58,12 +67,12 @@ command = $${make-rss:output}
[deploy-monitor-script]
[deploy-monitor-script]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
template = ${monitor-bin:location}/${monitor-bin:filename}
template = ${monitor-bin:location}/${monitor-bin:filename}
rendered = $${
directory:bin}/monitor.py
rendered = $${
monitor-parameters:executable}
mode = 0744
mode = 0744
context =
context =
section directory directory
section directory directory
raw monitoring_file_json $${directory:monitor-result}/monitor.json
key monitoring_file_json monitor-parameters:json-path
raw monitoring_file_bool $${directory:monitor-result}/monitor.bool
key monitoring_folder_bool monitor-parameters:result-dir
[deploy-rss-script]
[deploy-rss-script]
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
...
@@ -136,6 +145,7 @@ nginx_conf = $${nginx-conf:rendered}
...
@@ -136,6 +145,7 @@ nginx_conf = $${nginx-conf:rendered}
# Executables
# Executables
bin_nginx = ${nginx:location}/sbin/nginx
bin_nginx = ${nginx:location}/sbin/nginx
bin_launcher = $${directory:bin}/nginx-launcher
bin_launcher = $${directory:bin}/nginx-launcher
rss_feed = $${monitor-parameters:rss-path}
www = $${directory:www}
www = $${directory:www}
[nginx-conf]
[nginx-conf]
...
...
stack/monitor/monitor.py.in
View file @
0296b20a
...
@@ -13,8 +13,8 @@ monitor_dir = "{{ directory['monitor'] }}"
...
@@ -13,8 +13,8 @@ monitor_dir = "{{ directory['monitor'] }}"
pid_dir
=
"{{ directory['run'] }}"
pid_dir
=
"{{ directory['run'] }}"
promise_dir
=
"{{ directory['promise'] }}"
promise_dir
=
"{{ directory['promise'] }}"
monitoring_file_bool
=
"{{ monitoring_file_bool }}"
monitoring_file_json
=
"{{ monitoring_file_json }}"
monitoring_file_json
=
"{{ monitoring_file_json }}"
monitoring_folder_bool
=
"{{ monitoring_folder_bool }}"
option_list
=
[
option_list
=
[
make_option
(
"-a"
,
"--all"
,
action
=
"store_true"
,
dest
=
"all"
,
make_option
(
"-a"
,
"--all"
,
action
=
"store_true"
,
dest
=
"all"
,
...
@@ -88,14 +88,16 @@ def runScripts(directory):
...
@@ -88,14 +88,16 @@ def runScripts(directory):
def
writeFiles
(
monitors
):
def
writeFiles
(
monitors
):
if
len
(
monitors
)
==
0
:
if
len
(
monitors
)
==
0
:
message
=
"SUCCESS : everything is ok"
message
=
"SUCCESS : everything is ok
\
n
"
else
:
else
:
message
=
"FAILURE : something went wrong"
message
=
"FAILURE : something went wrong
\
n
"
date
=
datetime
.
datetime
.
now
().
ctime
()
date
=
datetime
.
datetime
.
now
().
ctime
()
monitors
[
'datetime'
]
=
date
monitors
[
'datetime'
]
=
date
open
(
monitoring_file_bool
,
"w+"
).
write
(
date
+
","
+
message
)
file_bool
=
os
.
path
.
join
(
monitoring_folder_bool
,
str
(
time
.
time
()))
open
(
file_bool
,
"w+"
).
write
(
date
+
","
+
message
)
open
(
monitoring_file_json
,
"w+"
).
write
(
json
.
dumps
(
monitors
))
open
(
monitoring_file_json
,
"w+"
).
write
(
json
.
dumps
(
monitors
))
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
parser
=
OptionParser
(
option_list
=
option_list
)
parser
=
OptionParser
(
option_list
=
option_list
)
monitors
=
{}
monitors
=
{}
...
...
stack/monitor/nginx_rss.conf.in
View file @
0296b20a
...
@@ -45,5 +45,9 @@ http {
...
@@ -45,5 +45,9 @@ http {
location / {
location / {
root {{ param_nginx['www'] }};
root {{ param_nginx['www'] }};
}
}
location /feed {
root {{ param_nginx['www'] }};
index {{ param_nginx['rss_feed'] }};
}
}
}
}
}
\ No newline at end of file
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