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
Xiaowu Zhang
slapos
Commits
ac01119a
Commit
ac01119a
authored
Jan 02, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: Implement check-certificate-expiration-days
parent
e6d45183
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
2 deletions
+102
-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
+83
-0
No files found.
software/monitor/buildout.hash.cfg
View file @
ac01119a
...
...
@@ -14,7 +14,7 @@
# not need these here).
[template]
filename = instance.cfg
md5sum =
cb814297f2f76dc8e08014a7d662439
f
md5sum =
d778b6f436ae6864819eb2ff2d12a86
f
[template-monitor]
_update_hash_filename_ = instance-monitor.cfg.jinja2
...
...
@@ -30,7 +30,7 @@ md5sum = 9e237dbdda59e788202f0da194a57d41
[template-monitor-edgebot]
_update_hash_filename_ = instance-monitor-edgebot.cfg.jinja2
md5sum =
cd4c5d2ecf8285ea8f0905ed1150d8a0
md5sum =
8786e4245db0d27dfa4815222d970e52
[network-bench-cfg]
filename = network_bench.cfg.in
...
...
software/monitor/instance-edgetest-input-schema.json
View file @
ac01119a
...
...
@@ -18,6 +18,12 @@
"title"
:
"Default space separated list of Frontend IPs to check"
,
"description"
:
"Default list of Frontend IPs to check, if empty no constraint is used."
,
"type"
:
"string"
},
"check-certificate-expiration-days"
:
{
"default"
:
"15"
,
"title"
:
"Default certificate expiration days check"
,
"description"
:
"Default amount of days to consider certitifcate as being to-be-expired (default: 15)."
,
"type"
:
"string"
}
}
}
software/monitor/instance-edgetest-slave-input-schema.json
View file @
ac01119a
...
...
@@ -17,6 +17,12 @@
"title"
:
"Space separated list of Frontend IPs to check"
,
"description"
:
"List of Frontend IPs to check, if empty no constraint is used (default: comes from master partition)."
,
"type"
:
"string"
},
"check-certificate-expiration-days"
:
{
"default"
:
"Master default"
,
"title"
:
"Certificate expiration days check"
,
"description"
:
"Default amount of days to consider certitifcate as being to-be-expired (default: comes from master partition)."
,
"type"
:
"string"
}
}
}
software/monitor/instance-monitor-edgebot.cfg.jinja2
View file @
ac01119a
...
...
@@ -13,6 +13,9 @@
{%- if 'check-status-code' not in slave %}
{%- do slave.__setitem__('check-status-code', CONFIGURATION['check-status-code']) %}
{%- endif %}
{%- if 'check-certificate-expiration-days' not in slave %}
{%- do slave.__setitem__('check-certificate-expiration-days', CONFIGURATION['check-certificate-expiration-days']) %}
{%- endif %}
{%- if 'check-frontend-ip' not in slave %}
{%- do slave.__setitem__('check-frontend-ip', CONFIGURATION['check-frontend-ip']) %}
{%- endif %}
...
...
@@ -33,6 +36,7 @@ name = {{ safe_name }}.py
config-report = http_query
config-url = {{ slave['url'] }}
config-status-code = {{ slave['check-status-code'] }}
config-certificate-expiration-days = {{ slave['check-certificate-expiration-days'] }}
config-ip-list = {{ slave['check-frontend-ip'] }}
config-json-file = ${surykatka-config:json}
{% endfor %}
...
...
software/monitor/instance.cfg
View file @
ac01119a
...
...
@@ -78,6 +78,7 @@ cert = $${slap-connection:cert-file}
configuration.check-status-code = 200
configuration.nameserver =
configuration.check-frontend-ip =
configuration.check-certificate-expiration-days = 15
# use monitor-base-port to have monitor listening on each instance
# on different port and also on different port than other services
# it makes it possible to instantiate it correctly on signle IP, for
...
...
software/monitor/test/test.py
View file @
ac01119a
...
...
@@ -269,6 +269,9 @@ URL =
self
.
assertPromiseContent
(
'http-query-backend-300-promise.py'
,
"'status-code': '300'"
)
self
.
assertPromiseContent
(
'http-query-backend-300-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-300-promise.py'
,
"'url': 'https://www.erp5.org/'"
)
...
...
@@ -286,6 +289,9 @@ URL =
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'status-code': '200'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'url': 'https://www.erp5.com/'"
)
...
...
@@ -334,6 +340,9 @@ URL =
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'status-code': '200'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'url': 'https://www.erp5.com/'"
)
...
...
@@ -373,6 +382,9 @@ URL =
self
.
assertPromiseContent
(
'http-query-backend-501-promise.py'
,
"'status-code': '501'"
)
self
.
assertPromiseContent
(
'http-query-backend-501-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-501-promise.py'
,
"'url': 'https://www.erp5.org/'"
)
...
...
@@ -390,6 +402,9 @@ URL =
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'status-code': '500'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'certificate-expiration-days': '15'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'url': 'https://www.erp5.com/'"
)
...
...
@@ -407,3 +422,71 @@ URL =
'backend-501'
,
{
'url'
:
'https://www.erp5.org/'
,
'check-status-code'
:
'501'
},
)
class
TestEdgeCheckCertificateExpirationDays
(
EdgeSlaveMixin
,
SlapOSInstanceTestCase
):
surykatka_ini
=
"""[SURYKATKA]
INTERVAL = 120
SQLITE = %(partition_path)s/srv/surykatka.db
URL =
https://www.erp5.com/
https://www.erp5.org/"""
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'check-certificate-expiration-days'
:
'10'
,
}
def
assertSurykatkaPromises
(
self
):
self
.
assertPromiseContent
(
'http-query-backend-20-promise.py'
,
"'ip-list': ''"
)
self
.
assertPromiseContent
(
'http-query-backend-20-promise.py'
,
"'report': 'http_query'"
)
self
.
assertPromiseContent
(
'http-query-backend-20-promise.py'
,
"'status-code': '200'"
)
self
.
assertPromiseContent
(
'http-query-backend-20-promise.py'
,
"'certificate-expiration-days': '20'"
)
self
.
assertPromiseContent
(
'http-query-backend-20-promise.py'
,
"'url': 'https://www.erp5.org/'"
)
self
.
assertPromiseContent
(
'http-query-backend-20-promise.py'
,
"'json-file': '%s'"
%
(
self
.
surykatka_json
,)
)
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'
,
"'certificate-expiration-days': '10'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'url': 'https://www.erp5.com/'"
)
self
.
assertPromiseContent
(
'http-query-backend-promise.py'
,
"'json-file': '%s'"
%
(
self
.
surykatka_json
,)
)
def
requestEdgetestSlaves
(
self
):
self
.
requestEdgetestSlave
(
'backend'
,
{
'url'
:
'https://www.erp5.com/'
},
)
self
.
requestEdgetestSlave
(
'backend-20'
,
{
'url'
:
'https://www.erp5.org/'
,
'check-certificate-expiration-days'
:
'20'
},
)
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