Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
e2a47f2a
Commit
e2a47f2a
authored
Jan 30, 2018
by
Joseph Mulloy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom thresholds option OPS-2721
parent
e5071d0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
util/jenkins/check-celery-queues.py
+18
-5
No files found.
util/jenkins/check-celery-queues.py
View file @
e2a47f2a
...
@@ -72,10 +72,17 @@ class CwBotoWrapper(object):
...
@@ -72,10 +72,17 @@ class CwBotoWrapper(object):
@click.option
(
'--max-metrics'
,
default
=
30
,
@click.option
(
'--max-metrics'
,
default
=
30
,
help
=
'Maximum number of CloudWatch metrics to publish'
)
help
=
'Maximum number of CloudWatch metrics to publish'
)
@click.option
(
'--threshold'
,
default
=
50
,
@click.option
(
'--threshold'
,
default
=
50
,
help
=
'Maximum queue length before alarm notification is sent'
)
help
=
'Default maximum queue length before alarm notification is'
+
' sent'
)
@click.option
(
'--queue-threshold'
,
type
=
(
str
,
int
),
multiple
=
True
,
help
=
'Threshold per queue in format --queue-threshold'
+
' {queue_name} {threshold}. May be used multiple times'
)
@click.option
(
'--sns-arn'
,
'-s'
,
help
=
'ARN for SNS alert topic'
,
required
=
True
)
@click.option
(
'--sns-arn'
,
'-s'
,
help
=
'ARN for SNS alert topic'
,
required
=
True
)
def
check_queues
(
host
,
port
,
environment
,
deploy
,
max_metrics
,
threshold
,
def
check_queues
(
host
,
port
,
environment
,
deploy
,
max_metrics
,
threshold
,
sns_arn
):
queue_threshold
,
sns_arn
):
thresholds
=
dict
(
queue_threshold
)
timeout
=
1
timeout
=
1
namespace
=
"celery/{}-{}"
.
format
(
environment
,
deploy
)
namespace
=
"celery/{}-{}"
.
format
(
environment
,
deploy
)
redis_client
=
RedisWrapper
(
host
=
host
,
port
=
port
,
socket_timeout
=
timeout
,
redis_client
=
RedisWrapper
(
host
=
host
,
port
=
port
,
socket_timeout
=
timeout
,
...
@@ -123,10 +130,16 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
...
@@ -123,10 +130,16 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
for
queue
in
queues
:
for
queue
in
queues
:
dimensions
=
[{
'Name'
:
dimension
,
'Value'
:
queue
}]
dimensions
=
[{
'Name'
:
dimension
,
'Value'
:
queue
}]
queue_threshold
=
threshold
if
queue
in
thresholds
:
queue_threshold
=
thresholds
[
queue
]
# Period of 300 is 5 minutes
period
=
300
period
=
300
evaluation_periods
=
1
# 6 periods of 5 min each is 30 minutes
# so queue must be over threshold for 30 minutes
evaluation_periods
=
6
comparison_operator
=
"GreaterThanThreshold"
comparison_operator
=
"GreaterThanThreshold"
treat_missing_data
=
"
miss
ing"
treat_missing_data
=
"
notBreach
ing"
statistic
=
"Maximum"
statistic
=
"Maximum"
actions
=
[
sns_arn
]
actions
=
[
sns_arn
]
alarm_name
=
"{}-{} {} queue length over threshold"
.
format
(
environment
,
alarm_name
=
"{}-{} {} queue length over threshold"
.
format
(
environment
,
...
@@ -145,7 +158,7 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
...
@@ -145,7 +158,7 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
Period
=
period
,
Period
=
period
,
EvaluationPeriods
=
evaluation_periods
,
EvaluationPeriods
=
evaluation_periods
,
TreatMissingData
=
treat_missing_data
,
TreatMissingData
=
treat_missing_data
,
Threshold
=
threshold
,
Threshold
=
queue_
threshold
,
ComparisonOperator
=
comparison_operator
,
ComparisonOperator
=
comparison_operator
,
Statistic
=
statistic
,
Statistic
=
statistic
,
AlarmActions
=
actions
)
AlarmActions
=
actions
)
...
...
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