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}
status=$${directory:monitor-result}/monitor.bool
RSS_
DIR=$${directory:monitor-result
}
STATUS=$${monitor-parameters:result-dir}
RSS_
FILE=$${monitor-parameters:rss-path
}
PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter}
STATUS2RSS=${rss-bin:location}/${rss-bin:filename}
NAME=`basename $status`
cat $status | $PYTHON $STATUS2RSS "Backup status $NAME" "http://localhost/$NAME.rss" > $RSS_DIR/monitor.rss
\ No newline at end of file
NAME=`basename $STATUS`
cat $STATUS/* | $PYTHON $STATUS2RSS "Monitoring RSS feed" "http://[$${slap-parameters:ipv6-random}]/feed" > $RSS_FILE
\ No newline at end of file
stack/monitor/monitor.cfg.in
View file @
0296b20a
...
...
@@ -6,6 +6,14 @@ url = $${slap-connection:server-url}
key = $${slap-connection:key-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]
home = $${buildout:directory}
etc = $${:home}/etc
...
...
@@ -20,6 +28,7 @@ cronstamps = $${:etc}/cronstamps
log = $${:var}/log
monitor = $${:etc}/monitor
monitor-result = $${:var}/monitor
monitor-result-bool = $${monitor-parameters:result-dir}
promise = $${:etc}/promise
run = $${:var}/run
service = $${:etc}/service/
...
...
@@ -46,7 +55,7 @@ log = $${directory:log}/cron.log
recipe = slapos.cookbook:cron.d
name = launch-monitor
frequency = * * * * *
command = $${
deploy-monitor-script:rendered
} -a
command = $${
monitor-parameters:executable
} -a
[cron-entry-rss]
<= cron
...
...
@@ -58,12 +67,12 @@ command = $${make-rss:output}
[deploy-monitor-script]
recipe = slapos.recipe.template:jinja2
template = ${monitor-bin:location}/${monitor-bin:filename}
rendered = $${
directory:bin}/monitor.py
rendered = $${
monitor-parameters:executable}
mode = 0744
context =
section directory directory
raw monitoring_file_json $${directory:monitor-result}/monitor.json
raw monitoring_file_bool $${directory:monitor-result}/monitor.bool
key monitoring_file_json monitor-parameters:json-path
key monitoring_folder_bool monitor-parameters:result-dir
[deploy-rss-script]
recipe = hexagonit.recipe.download
...
...
@@ -136,6 +145,7 @@ nginx_conf = $${nginx-conf:rendered}
# Executables
bin_nginx = ${nginx:location}/sbin/nginx
bin_launcher = $${directory:bin}/nginx-launcher
rss_feed = $${monitor-parameters:rss-path}
www = $${directory:www}
[nginx-conf]
...
...
stack/monitor/monitor.py.in
View file @
0296b20a
...
...
@@ -13,8 +13,8 @@ monitor_dir = "{{ directory['monitor'] }}"
pid_dir
=
"{{ directory['run'] }}"
promise_dir
=
"{{ directory['promise'] }}"
monitoring_file_bool
=
"{{ monitoring_file_bool }}"
monitoring_file_json
=
"{{ monitoring_file_json }}"
monitoring_folder_bool
=
"{{ monitoring_folder_bool }}"
option_list
=
[
make_option
(
"-a"
,
"--all"
,
action
=
"store_true"
,
dest
=
"all"
,
...
...
@@ -88,14 +88,16 @@ def runScripts(directory):
def
writeFiles
(
monitors
):
if
len
(
monitors
)
==
0
:
message
=
"SUCCESS : everything is ok"
message
=
"SUCCESS : everything is ok
\
n
"
else
:
message
=
"FAILURE : something went wrong"
message
=
"FAILURE : something went wrong
\
n
"
date
=
datetime
.
datetime
.
now
().
ctime
()
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
))
if
__name__
==
"__main__"
:
parser
=
OptionParser
(
option_list
=
option_list
)
monitors
=
{}
...
...
stack/monitor/nginx_rss.conf.in
View file @
0296b20a
...
...
@@ -45,5 +45,9 @@ http {
location / {
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