Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
35c27641
Commit
35c27641
authored
5 years ago
by
Nikolay Stanchev
Browse files
Options
Downloads
Patches
Plain Diff
Extends alerts integration test with a threshold batch alert
parent
1ced0c84
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/clmctest/alerts/alerts_test_config.yaml
+17
-0
17 additions, 0 deletions
src/test/clmctest/alerts/alerts_test_config.yaml
src/test/clmctest/alerts/test_alerts.py
+13
-13
13 additions, 13 deletions
src/test/clmctest/alerts/test_alerts.py
with
30 additions
and
13 deletions
src/test/clmctest/alerts/alerts_test_config.yaml
+
17
−
0
View file @
35c27641
...
@@ -48,6 +48,23 @@ topology_template:
...
@@ -48,6 +48,23 @@ topology_template:
implementation
:
implementation
:
-
flame_sfemc
-
flame_sfemc
-
http://172.40.231.200:9999/
-
http://172.40.231.200:9999/
increase_in_running_processes_batch
:
description
:
This event triggers when the max number of running processes increases. Trigger uses batch mode for monitoring.
metadata
:
monitoring_type
:
batch
event_type
:
threshold
metric
:
processes.running
condition
:
threshold
:
0
granularity
:
30
aggregation_method
:
max
resource_type
:
flame_location
:
DC1
flame_sfp
:
nginx
comparison_operator
:
gte
action
:
implementation
:
-
http://172.40.231.200:9999/
increase_in_active_requests
:
increase_in_active_requests
:
description
:
This event triggers when the number of nginx accept requests increases.
description
:
This event triggers when the number of nginx accept requests increases.
event_type
:
relative
event_type
:
relative
...
...
This diff is collapsed.
Click to expand it.
src/test/clmctest/alerts/test_alerts.py
+
13
−
13
View file @
35c27641
...
@@ -59,6 +59,12 @@ expected_alerts_list = [
...
@@ -59,6 +59,12 @@ expected_alerts_list = [
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8/handlers
"
},
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8/handlers
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_running_processes_batch
"
,
"
task_identifier
"
:
"
0b5a63415f4e38e3bad89cf9f8c9094f7ef59497800154432283f3e193776ce3
"
,
"
handlers
"
:
[
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
0b5a63415f4e38e3bad89cf9f8c9094f7ef59497800154432283f3e193776ce3
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/0b5a63415f4e38e3bad89cf9f8c9094f7ef59497800154432283f3e193776ce3
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/0b5a63415f4e38e3bad89cf9f8c9094f7ef59497800154432283f3e193776ce3
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/0b5a63415f4e38e3bad89cf9f8c9094f7ef59497800154432283f3e193776ce3/handlers
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
,
"
task_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
,
"
task_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
topic_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
...
@@ -73,6 +79,11 @@ expected_alerts_list = [
...
@@ -73,6 +79,11 @@ expected_alerts_list = [
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73/handlers
"
}
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73/handlers
"
}
]
]
expected_deleted_alerts
=
[{
"
policy
"
:
alert_object
[
"
policy
"
],
"
trigger
"
:
alert_object
[
"
trigger
"
]}
for
alert_object
in
expected_alerts_list
]
expected_alerts_list
=
sorted
(
expected_alerts_list
,
key
=
lambda
x
:
x
[
'
trigger
'
])
expected_deleted_handlers
=
[{
"
policy
"
:
alert_object
[
"
policy
"
],
"
trigger
"
:
alert_object
[
"
trigger
"
],
"
handler
"
:
handler
}
for
alert_object
in
expected_alerts_list
for
handler
in
alert_object
[
"
handlers
"
]]
expected_deleted_handlers
=
sorted
(
expected_deleted_handlers
,
key
=
lambda
x
:
(
x
[
'
handler
'
],
x
[
'
trigger
'
]))
def
is_valid_timestamp
(
str_timestamp
):
def
is_valid_timestamp
(
str_timestamp
):
try
:
try
:
...
@@ -273,20 +284,9 @@ class TestAlerts(object):
...
@@ -273,20 +284,9 @@ class TestAlerts(object):
json_response
=
response
.
json
()
json_response
=
response
.
json
()
# sort by trigger to ensure comparison order is correct
# sort by trigger to ensure comparison order is correct
assert
sorted
(
json_response
[
"
deleted_alerts
"
],
key
=
lambda
x
:
x
[
'
trigger
'
])
==
[{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
high_requests
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_active_requests
"
},
assert
sorted
(
json_response
[
"
deleted_alerts
"
],
key
=
lambda
x
:
x
[
'
trigger
'
])
==
expected_deleted_alerts
,
"
Incorrect list of deleted alerts
"
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_running_processes
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
service_started
"
}],
\
"
Incorrect list of deleted alerts
"
# sort by handler and trigger to ensure comparison order is correct
# sort by handler and trigger to ensure comparison order is correct
assert
sorted
(
json_response
[
"
deleted_handlers
"
],
key
=
lambda
x
:
(
x
[
'
handler
'
],
x
[
'
trigger
'
]))
==
[{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_active_requests
"
,
"
handler
"
:
SFEMC
},
assert
sorted
(
json_response
[
"
deleted_handlers
"
],
key
=
lambda
x
:
(
x
[
'
handler
'
],
x
[
'
trigger
'
]))
==
expected_deleted_handlers
,
"
Incorrect list of deleted handlers
"
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_running_processes
"
,
"
handler
"
:
SFEMC
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
,
"
handler
"
:
SFEMC
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
high_requests
"
,
"
handler
"
:
"
http://172.40.231.200:9999/
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_active_requests
"
,
"
handler
"
:
"
http://172.40.231.200:9999/
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_running_processes
"
,
"
handler
"
:
"
http://172.40.231.200:9999/
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
,
"
handler
"
:
"
http://172.40.231.200:9999/
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
service_started
"
,
"
handler
"
:
"
http://172.40.231.200:9999/
"
}],
\
"
Incorrect list of deleted handlers
"
def
test_alerts_update_request
(
self
,
rspec_config
):
def
test_alerts_update_request
(
self
,
rspec_config
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment