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
Thomas Leymonerie
slapos
Commits
b0915f98
Commit
b0915f98
authored
Sep 09, 2020
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: support check-http-header-dict.
parent
e2f1d7be
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
2 deletions
+103
-2
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/test/test.py
software/monitor/test/test.py
+84
-0
No files found.
software/monitor/buildout.hash.cfg
View file @
b0915f98
...
...
@@ -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 @
b0915f98
...
...
@@ -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 @
b0915f98
...
...
@@ -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 @
b0915f98
...
...
@@ -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 @
b0915f98
...
...
@@ -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/test/test.py
View file @
b0915f98
...
...
@@ -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
=
{
...
...
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