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
Levin Zimmermann
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
Hide 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
[template-monitor-edgetest-basic]
_update_hash_filename_ = instance-monitor-edgetest-basic.cfg.jinja2
md5sum =
6b933beb0744d97c7760e4601298e13
7
md5sum =
fa044accc1230ece41edfc822eb39f0
7
[template-node-monitoring]
_update_hash_filename_ = instance-node-monitoring.jinja2.cfg
...
...
software/monitor/instance-edgetest-basic-input-schema.json
View file @
ee26003f
...
...
@@ -97,6 +97,12 @@
"type"
:
"number"
,
"default"
:
2
,
"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 @@
'failure-amount': 2,
'check-maximum-elapsed-time': 2,
'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 %}
{%- do DEFAULT_DICT.__setitem__(default_key, slapparameter_dict[default_key]) %}
{%- endif %}
...
...
@@ -68,6 +69,7 @@ config-certificate-expiration-days = {{ check['check-certificate-expiration-days
config-failure-amount = {{ check['failure-amount'] }}
config-maximum-elapsed-time = {{ check['check-maximum-elapsed-time'] }}
config-ip-list = {{ ' '.join(check['check-frontend-ip-list']) }}
config-enabled-sense-list = {{ check['enabled-sense-list'] }}
config-json-file = ${surykatka-config-{{ class }}:json}
{%- endfor %} {#- for url in check['url-list'] #}
{%- endfor %} {#- for check in class_check_list | sort(attribute='-name') #}
...
...
software/monitor/test/test.py
View file @
ee26003f
...
...
@@ -377,12 +377,16 @@ URL =
def
getInstanceSoftwareType
(
cls
):
return
'edgetest-basic'
enabled_sense_list
=
"'dns_query tcp_server http_query ssl_certificate '
\
n
"
\
" 'elapsed_time'"
def
assertSurykatkaPromises
(
self
):
self
.
assertHttpQueryPromiseContent
(
'edge0'
,
'path-check'
,
'https://path.example.com/path'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -391,6 +395,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://path.example.com/path'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -398,6 +403,7 @@ URL =
'domain-check'
,
'https://domain.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -406,6 +412,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://domain.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -413,6 +420,7 @@ URL =
'domain-check'
,
'http://domain.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -421,6 +429,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'http://domain.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -428,6 +437,7 @@ URL =
'frontend-check'
,
'https://frontend.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.3',
...
...
@@ -436,6 +446,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://frontend.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -443,6 +454,7 @@ URL =
'frontend-empty-check'
,
'https://frontendempty.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '',
...
...
@@ -451,6 +463,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://frontendempty.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -458,6 +471,7 @@ URL =
'status-check'
,
'https://status.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -466,6 +480,7 @@ URL =
'report': 'http_query',
'status-code': '202',
'url': 'https://status.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -473,6 +488,7 @@ URL =
'certificate-check'
,
'https://certificate.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '11',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -481,6 +497,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://certificate.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -488,6 +505,7 @@ URL =
'time-check'
,
'https://time.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -496,6 +514,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://time.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
11
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -503,6 +522,7 @@ URL =
'failure-check'
,
'https://failure.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '3',
'http-header-dict': '{}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -511,6 +531,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://failure.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
self
.
assertHttpQueryPromiseContent
(
...
...
@@ -518,6 +539,7 @@ URL =
'header-check'
,
'https://header.example.com'
,
"""extra_config_dict = { 'certificate-expiration-days': '7',
'enabled-sense-list': %s,
'failure-amount': '1',
'http-header-dict': '{"A": "AAA"}',
'ip-list': '127.0.0.1 127.0.0.2',
...
...
@@ -526,6 +548,7 @@ URL =
'report': 'http_query',
'status-code': '201',
'url': 'https://header.example.com'}"""
%
(
self
.
enabled_sense_list
,
self
.
surykatka_dict
[
'edge0'
][
5
][
'json-file'
],))
def
test
(
self
):
...
...
@@ -545,6 +568,17 @@ URL =
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
):
"""Test class for node monitoring instanciation"""
@
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