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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos
Commits
ee26003f
Commit
ee26003f
authored
May 16, 2023
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/monitor: Implement enabled-sense-list
parent
8c400bfa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
+45
-3
software/monitor/buildout.hash.cfg
software/monitor/buildout.hash.cfg
+1
-1
software/monitor/instance-edgetest-basic-input-schema.json
software/monitor/instance-edgetest-basic-input-schema.json
+6
-0
software/monitor/instance-monitor-edgetest-basic.cfg.jinja2
software/monitor/instance-monitor-edgetest-basic.cfg.jinja2
+4
-2
software/monitor/test/test.py
software/monitor/test/test.py
+34
-0
No files found.
software/monitor/buildout.hash.cfg
View file @
ee26003f
...
@@ -22,7 +22,7 @@ md5sum = 2eb5596544d9c341acf653d4f7ce2680
...
@@ -22,7 +22,7 @@ md5sum = 2eb5596544d9c341acf653d4f7ce2680
[template-monitor-edgetest-basic]
[template-monitor-edgetest-basic]
_update_hash_filename_ = instance-monitor-edgetest-basic.cfg.jinja2
_update_hash_filename_ = instance-monitor-edgetest-basic.cfg.jinja2
md5sum =
6b933beb0744d97c7760e4601298e13
7
md5sum =
fa044accc1230ece41edfc822eb39f0
7
[template-node-monitoring]
[template-node-monitoring]
_update_hash_filename_ = instance-node-monitoring.jinja2.cfg
_update_hash_filename_ = instance-node-monitoring.jinja2.cfg
...
...
software/monitor/instance-edgetest-basic-input-schema.json
View file @
ee26003f
...
@@ -97,6 +97,12 @@
...
@@ -97,6 +97,12 @@
"type"
:
"number"
,
"type"
:
"number"
,
"default"
:
2
,
"default"
:
2
,
"minimum"
:
1
"minimum"
:
1
},
"enabled-sense-list"
:
{
"title"
:
"[EXPERT] Enabled Senses"
,
"description"
:
"Space separated list of enabled senses of the promise."
,
"type"
:
"string"
,
"default"
:
"dns_query tcp_server http_query ssl_certificate elapsed_time"
}
}
}
}
}
}
software/monitor/instance-monitor-edgetest-basic.cfg.jinja2
View file @
ee26003f
...
@@ -6,9 +6,10 @@
...
@@ -6,9 +6,10 @@
'failure-amount': 2,
'failure-amount': 2,
'check-maximum-elapsed-time': 2,
'check-maximum-elapsed-time': 2,
'check-frontend-ip-list': [],
'check-frontend-ip-list': [],
'nameserver-list': []
'nameserver-list': [],
'enabled-sense-list': 'dns_query tcp_server http_query ssl_certificate elapsed_time'
} %}
} %}
{%- for default_key in ['check-frontend-ip-list', 'nameserver-list', 'check-status-code', 'check-certificate-expiration-days', 'check-maximum-elapsed-time', 'failure-amount'] %}
{%- for default_key in ['check-frontend-ip-list', 'nameserver-list', 'check-status-code', 'check-certificate-expiration-days', 'check-maximum-elapsed-time', 'failure-amount'
, 'enabled-sense-list'
] %}
{%- if default_key in slapparameter_dict %}
{%- if default_key in slapparameter_dict %}
{%- do DEFAULT_DICT.__setitem__(default_key, slapparameter_dict[default_key]) %}
{%- do DEFAULT_DICT.__setitem__(default_key, slapparameter_dict[default_key]) %}
{%- endif %}
{%- endif %}
...
@@ -68,6 +69,7 @@ config-certificate-expiration-days = {{ check['check-certificate-expiration-days
...
@@ -68,6 +69,7 @@ config-certificate-expiration-days = {{ check['check-certificate-expiration-days
config-failure-amount = {{ check['failure-amount'] }}
config-failure-amount = {{ check['failure-amount'] }}
config-maximum-elapsed-time = {{ check['check-maximum-elapsed-time'] }}
config-maximum-elapsed-time = {{ check['check-maximum-elapsed-time'] }}
config-ip-list = {{ ' '.join(check['check-frontend-ip-list']) }}
config-ip-list = {{ ' '.join(check['check-frontend-ip-list']) }}
config-enabled-sense-list = {{ check['enabled-sense-list'] }}
config-json-file = ${surykatka-config-{{ class }}:json}
config-json-file = ${surykatka-config-{{ class }}:json}
{%- endfor %} {#- for url in check['url-list'] #}
{%- endfor %} {#- for url in check['url-list'] #}
{%- endfor %} {#- for check in class_check_list | sort(attribute='-name') #}
{%- endfor %} {#- for check in class_check_list | sort(attribute='-name') #}
...
...
software/monitor/test/test.py
View file @
ee26003f
...
@@ -377,12 +377,16 @@ URL =
...
@@ -377,12 +377,16 @@ URL =
def
getInstanceSoftwareType
(
cls
):
def
getInstanceSoftwareType
(
cls
):
return
'edgetest-basic'
return
'edgetest-basic'
enabled_sense_list
=
"'dns_query tcp_server http_query ssl_certificate '
\
n
"
\
" 'elapsed_time'"
def
assertSurykatkaPromises
(
self
):
def
assertSurykatkaPromises
(
self
):
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
'edge0'
,
'edge0'
,
'path-check'
,
'path-check'
,
'https://path.example.com/path'
,
'https://path.example.com/path'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -391,6 +395,7 @@ URL =
...
@@ -391,6 +395,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://path.example.com/path'}"""
%
(
'url': 'https://path.example.com/path'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -398,6 +403,7 @@ URL =
...
@@ -398,6 +403,7 @@ URL =
'domain-check'
,
'domain-check'
,
'https://domain.example.com'
,
'https://domain.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -406,6 +412,7 @@ URL =
...
@@ -406,6 +412,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://domain.example.com'}"""
%
(
'url': 'https://domain.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -413,6 +420,7 @@ URL =
...
@@ -413,6 +420,7 @@ URL =
'domain-check'
,
'domain-check'
,
'http://domain.example.com'
,
'http://domain.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -421,6 +429,7 @@ URL =
...
@@ -421,6 +429,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'http://domain.example.com'}"""
%
(
'url': 'http://domain.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -428,6 +437,7 @@ URL =
...
@@ -428,6 +437,7 @@ URL =
'frontend-check'
,
'frontend-check'
,
'https://frontend.example.com'
,
'https://frontend.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.3',
'ip-list': '127.0.0.3',
...
@@ -436,6 +446,7 @@ URL =
...
@@ -436,6 +446,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://frontend.example.com'}"""
%
(
'url': 'https://frontend.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -443,6 +454,7 @@ URL =
...
@@ -443,6 +454,7 @@ URL =
'frontend-empty-check'
,
'frontend-empty-check'
,
'https://frontendempty.example.com'
,
'https://frontendempty.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '',
'ip-list': '',
...
@@ -451,6 +463,7 @@ URL =
...
@@ -451,6 +463,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://frontendempty.example.com'}"""
%
(
'url': 'https://frontendempty.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -458,6 +471,7 @@ URL =
...
@@ -458,6 +471,7 @@ URL =
'status-check'
,
'status-check'
,
'https://status.example.com'
,
'https://status.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -466,6 +480,7 @@ URL =
...
@@ -466,6 +480,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '202',
'status-code': '202',
'url': 'https://status.example.com'}"""
%
(
'url': 'https://status.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -473,6 +488,7 @@ URL =
...
@@ -473,6 +488,7 @@ URL =
'certificate-check'
,
'certificate-check'
,
'https://certificate.example.com'
,
'https://certificate.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '11',
"""extra_config_dict = { 'certificate-expiration-days': '11',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -481,6 +497,7 @@ URL =
...
@@ -481,6 +497,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://certificate.example.com'}"""
%
(
'url': 'https://certificate.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -488,6 +505,7 @@ URL =
...
@@ -488,6 +505,7 @@ URL =
'time-check'
,
'time-check'
,
'https://time.example.com'
,
'https://time.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -496,6 +514,7 @@ URL =
...
@@ -496,6 +514,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://time.example.com'}"""
%
(
'url': 'https://time.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
11
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
11
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -503,6 +522,7 @@ URL =
...
@@ -503,6 +522,7 @@ URL =
'failure-check'
,
'failure-check'
,
'https://failure.example.com'
,
'https://failure.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '3',
'failure-amount': '3',
'http-header-dict': '{}',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -511,6 +531,7 @@ URL =
...
@@ -511,6 +531,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://failure.example.com'}"""
%
(
'url': 'https://failure.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
self
.
assertHttpQueryPromiseContent
(
...
@@ -518,6 +539,7 @@ URL =
...
@@ -518,6 +539,7 @@ URL =
'header-check'
,
'header-check'
,
'https://header.example.com'
,
'https://header.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'failure-amount': '1',
'http-header-dict': '{"A": "AAA"}',
'http-header-dict': '{"A": "AAA"}',
'ip-list': '127.0.0.1 127.0.0.2',
'ip-list': '127.0.0.1 127.0.0.2',
...
@@ -526,6 +548,7 @@ URL =
...
@@ -526,6 +548,7 @@ URL =
'report': 'http_query',
'report': 'http_query',
'status-code': '201',
'status-code': '201',
'url': 'https://header.example.com'}"""
%
(
'url': 'https://header.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
def
test
(
self
):
def
test
(
self
):
...
@@ -545,6 +568,17 @@ URL =
...
@@ -545,6 +568,17 @@ URL =
self
.
assertConnectionParameterDict
()
self
.
assertConnectionParameterDict
()
class
TestEdgeBasicEnableSenseList
(
TestEdgeBasic
):
enabled_sense_list
=
"'ssl_certificate'"
@
classmethod
def
getInstanceParameterDict
(
cls
):
orig_instance_parameter_dict
=
super
().
getInstanceParameterDict
()
_
=
json
.
loads
(
orig_instance_parameter_dict
[
'_'
])
_
[
'enabled-sense-list'
]
=
'ssl_certificate'
return
{
'_'
:
json
.
dumps
(
_
)}
class
TestNodeMonitoring
(
SlapOSInstanceTestCase
):
class
TestNodeMonitoring
(
SlapOSInstanceTestCase
):
"""Test class for node monitoring instanciation"""
"""Test class for node monitoring instanciation"""
@
classmethod
@
classmethod
...
...
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