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
Łukasz Nowak
slapos
Commits
fe72c661
Commit
fe72c661
authored
Sep 16, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Plain Diff
monitor: support http-header-dict.
See merge request
nexedi/slapos!808
parents
7a8a364a
b0915f98
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
106 additions
and
5 deletions
+106
-5
software/monitor/buildout.hash.cfg
software/monitor/buildout.hash.cfg
+2
-2
software/monitor/instance-edgetest-input-schema.json
software/monitor/instance-edgetest-input-schema.json
+6
-0
software/monitor/instance-edgetest-slave-input-schema.json
software/monitor/instance-edgetest-slave-input-schema.json
+6
-0
software/monitor/instance-monitor-edgebot.cfg.jinja2
software/monitor/instance-monitor-edgebot.cfg.jinja2
+4
-0
software/monitor/instance.cfg
software/monitor/instance.cfg
+1
-0
software/monitor/software.cfg
software/monitor/software.cfg
+2
-2
software/monitor/test/test.py
software/monitor/test/test.py
+84
-0
stack/slapos.cfg
stack/slapos.cfg
+1
-1
No files found.
software/monitor/buildout.hash.cfg
View file @
fe72c661
...
...
@@ -14,7 +14,7 @@
# not need these here).
[template]
filename = instance.cfg
md5sum =
1b5d5a72d0d0e3156770ce8ecc5d19ce
md5sum =
9ddae686379e8d747410c1adf82b47d6
[template-monitor]
_update_hash_filename_ = instance-monitor.cfg.jinja2
...
...
@@ -30,7 +30,7 @@ md5sum = a57106ee88ff3295b9ffce84105da79b
[template-monitor-edgebot]
_update_hash_filename_ = instance-monitor-edgebot.cfg.jinja2
md5sum = c
535f4df6388cdc3f6c1df2a91d6dd53
md5sum = c
1885a42aadd45bab3185a53258d4ff4
[network-bench-cfg]
filename = network_bench.cfg.in
...
...
software/monitor/instance-edgetest-input-schema.json
View file @
fe72c661
...
...
@@ -13,6 +13,12 @@
"description"
:
"Default HTTP code to check against (default: 200)."
,
"type"
:
"string"
},
"check-http-header-dict"
:
{
"default"
:
"{}"
,
"title"
:
"HTTP header dict to check"
,
"description"
:
"JSON dict of expected HTTP header, like {
\"
Cache-Control
\"
:
\"
max-age=3600, public
\"
,
\"
Vary
\"
:
\"
Accept-Encoding
\"
}"
,
"type"
:
"object"
},
"check-frontend-ip"
:
{
"default"
:
""
,
"title"
:
"Default space separated list of Frontend IPs to check"
,
...
...
software/monitor/instance-edgetest-slave-input-schema.json
View file @
fe72c661
...
...
@@ -12,6 +12,12 @@
"description"
:
"HTTP code to check against (default: comes from master partition)."
,
"type"
:
"string"
},
"check-http-header-dict"
:
{
"default"
:
"Master default"
,
"title"
:
"HTTP header dict to check"
,
"description"
:
"JSON dict of expected HTTP header, like {
\"
Cache-Control
\"
:
\"
max-age=3600, public
\"
,
\"
Vary
\"
:
\"
Accept-Encoding
\"
}"
,
"type"
:
"object"
},
"check-frontend-ip"
:
{
"default"
:
"Master default"
,
"title"
:
"Space separated list of Frontend IPs to check"
,
...
...
software/monitor/instance-monitor-edgebot.cfg.jinja2
View file @
fe72c661
...
...
@@ -13,6 +13,9 @@
{%- if 'check-status-code' not in slave %}
{%- do slave.__setitem__('check-status-code', CONFIGURATION['check-status-code']) %}
{%- endif %}
{%- if 'check-http-header-dict' not in slave %}
{%- do slave.__setitem__('check-http-header-dict', CONFIGURATION['check-http-header-dict']) %}
{%- endif %}
{%- if 'check-certificate-expiration-days' not in slave %}
{%- do slave.__setitem__('check-certificate-expiration-days', CONFIGURATION['check-certificate-expiration-days']) %}
{%- endif %}
...
...
@@ -48,6 +51,7 @@ name = {{ safe_name }}.py
config-report = http_query
config-url = {{ slave['url'] }}
config-status-code = {{ slave['check-status-code'] }}
config-http-header-dict = {{ slave['check-http-header-dict'] }}
config-certificate-expiration-days = {{ slave['check-certificate-expiration-days'] }}
config-failure-amount = {{ slave['failure-amount'] }}
config-maximum-elapsed-time = {{ slave['check-maximum-elapsed-time'] }}
...
...
software/monitor/instance.cfg
View file @
fe72c661
...
...
@@ -76,6 +76,7 @@ key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
# Defaults
configuration.check-status-code = 200
configuration.check-http-header-dict = {}
configuration.nameserver =
configuration.check-frontend-ip =
configuration.check-certificate-expiration-days = 15
...
...
software/monitor/software.cfg
View file @
fe72c661
...
...
@@ -78,9 +78,9 @@ scripts =
[versions]
slapos.recipe.template = 4.4
surykatka = 0.
4.2
surykatka = 0.
5.0
# For surykatka 0.
4.2
# For surykatka 0.
5.0
click = 7.0
certifi = 2019.11.28
chardet = 3.0.4
...
...
software/monitor/test/test.py
View file @
fe72c661
...
...
@@ -470,6 +470,90 @@ URL =
)
class
TestEdgeCheckHTTPHeaderDict
(
EdgeSlaveMixin
,
SlapOSInstanceTestCase
):
surykatka_dict
=
{
2
:
{
'expected_ini'
:
"""[SURYKATKA]
INTERVAL = 120
TIMEOUT = 4
SQLITE = %(db_file)s
URL =
https://www.erp5.com/
https://www.erp5.org/"""
}
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'check-http-header-dict'
:
'{"B": "BBB"}'
,
}
def
assertSurykatkaPromises
(
self
):
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'ip-list': ''"
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'report': 'http_query'"
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'status-code': '200'"
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'http-header-dict': '{
\
"
A
\
"
:
\
"
AAA
\
"
}'"
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'url': 'https://www.erp5.org/'"
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'json-file': '%s'"
%
(
self
.
surykatka_dict
[
2
][
'json-file'
],)
)
self
.
assertPromiseContent
(
'http-query-backend-http-header-promise.py'
,
"'failure-amount': '2'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'ip-list': ''"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'report': 'http_query'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'status-code': '200'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'http-header-dict': '{
\
"
B
\
"
:
\
"
BBB
\
"
}'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'url': 'https://www.erp5.com/'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'json-file': '%s'"
%
(
self
.
surykatka_dict
[
2
][
'json-file'
],)
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'failure-amount': '2'"
)
def
requestEdgetestSlaves
(
self
):
self
.
requestEdgetestSlave
(
'backend'
,
{
'url'
:
'https://www.erp5.com/'
},
)
self
.
requestEdgetestSlave
(
'backend-http-header'
,
{
'url'
:
'https://www.erp5.org/'
,
'check-http-header-dict'
:
'{"A": "AAA"}'
},
)
class
TestEdgeCheckCertificateExpirationDays
(
EdgeSlaveMixin
,
SlapOSInstanceTestCase
):
surykatka_dict
=
{
...
...
stack/slapos.cfg
View file @
fe72c661
...
...
@@ -180,7 +180,7 @@ slapos.libnetworkcache = 0.20
slapos.rebootstrap = 4.5
slapos.recipe.build = 0.46
slapos.recipe.cmmi = 0.16
slapos.toolbox = 0.11
0
slapos.toolbox = 0.11
1
stevedore = 1.21.0
subprocess32 = 3.5.3
unicodecsv = 0.14.1
...
...
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