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
da6e5f3a
Unverified
Commit
da6e5f3a
authored
Jan 12, 2018
by
Joseph Mulloy
Committed by
GitHub
Jan 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4282 from edx/jdmulloy/ops2545/redis_script_alarm_thresholds
Prevent reconfiguring alarms OPS-2545
parents
81feb823
5893c690
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
util/jenkins/check-celery-queues.py
+22
-16
No files found.
util/jenkins/check-celery-queues.py
View file @
da6e5f3a
...
...
@@ -100,7 +100,8 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
if
len
(
all_queues
)
>
max_metrics
:
# TODO: Use proper logging framework
print
(
"Warning! Too many metrics, refusing to publish more than {}"
.
format
(
max_metrics
))
print
(
"Warning! Too many metrics, refusing to publish more than {}"
.
format
(
max_metrics
))
# Take first max_metrics number of queues from all_queues and remove
# queues that aren't in redis
...
...
@@ -128,21 +129,26 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
treat_missing_data
=
"missing"
statistic
=
"Maximum"
actions
=
[
sns_arn
]
alarm_name
=
"{} queue length over threshold"
.
format
(
queue
)
# Always create/configure alert to keep config up to date
cloudwatch
.
put_metric_alarm
(
AlarmName
=
alarm_name
,
AlarmDescription
=
alarm_name
,
Namespace
=
namespace
,
MetricName
=
metric_name
,
Dimensions
=
dimensions
,
Period
=
period
,
EvaluationPeriods
=
evaluation_periods
,
TreatMissingData
=
treat_missing_data
,
Threshold
=
threshold
,
ComparisonOperator
=
comparison_operator
,
Statistic
=
statistic
,
AlarmActions
=
actions
)
alarm_name
=
"{}-{} {} queue length over threshold"
.
format
(
environment
,
deploy
,
queue
)
if
len
(
cloudwatch
.
describe_alarms_for_metric
(
Namespace
=
namespace
,
MetricName
=
metric_name
,
Dimensions
=
dimensions
)
[
'MetricAlarms'
])
<
1
:
print
(
'Creating new alarm "{}"'
.
format
(
alarm_name
))
cloudwatch
.
put_metric_alarm
(
AlarmName
=
alarm_name
,
AlarmDescription
=
alarm_name
,
Namespace
=
namespace
,
MetricName
=
metric_name
,
Dimensions
=
dimensions
,
Period
=
period
,
EvaluationPeriods
=
evaluation_periods
,
TreatMissingData
=
treat_missing_data
,
Threshold
=
threshold
,
ComparisonOperator
=
comparison_operator
,
Statistic
=
statistic
,
AlarmActions
=
actions
)
if
__name__
==
'__main__'
:
...
...
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