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
7 years ago
by
Joseph Mulloy
Committed by
GitHub
7 years ago
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,
...
@@ -100,7 +100,8 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
if
len
(
all_queues
)
>
max_metrics
:
if
len
(
all_queues
)
>
max_metrics
:
# TODO: Use proper logging framework
# 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
# Take first max_metrics number of queues from all_queues and remove
# queues that aren't in redis
# queues that aren't in redis
...
@@ -128,21 +129,26 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
...
@@ -128,21 +129,26 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
treat_missing_data
=
"missing"
treat_missing_data
=
"missing"
statistic
=
"Maximum"
statistic
=
"Maximum"
actions
=
[
sns_arn
]
actions
=
[
sns_arn
]
alarm_name
=
"{} queue length over threshold"
.
format
(
queue
)
alarm_name
=
"{}-{} {} queue length over threshold"
.
format
(
environment
,
deploy
,
# Always create/configure alert to keep config up to date
queue
)
cloudwatch
.
put_metric_alarm
(
AlarmName
=
alarm_name
,
if
len
(
cloudwatch
.
describe_alarms_for_metric
(
Namespace
=
namespace
,
AlarmDescription
=
alarm_name
,
MetricName
=
metric_name
,
Namespace
=
namespace
,
Dimensions
=
dimensions
)
MetricName
=
metric_name
,
[
'MetricAlarms'
])
<
1
:
Dimensions
=
dimensions
,
print
(
'Creating new alarm "{}"'
.
format
(
alarm_name
))
Period
=
period
,
cloudwatch
.
put_metric_alarm
(
AlarmName
=
alarm_name
,
EvaluationPeriods
=
evaluation_periods
,
AlarmDescription
=
alarm_name
,
TreatMissingData
=
treat_missing_data
,
Namespace
=
namespace
,
Threshold
=
threshold
,
MetricName
=
metric_name
,
ComparisonOperator
=
comparison_operator
,
Dimensions
=
dimensions
,
Statistic
=
statistic
,
Period
=
period
,
AlarmActions
=
actions
)
EvaluationPeriods
=
evaluation_periods
,
TreatMissingData
=
treat_missing_data
,
Threshold
=
threshold
,
ComparisonOperator
=
comparison_operator
,
Statistic
=
statistic
,
AlarmActions
=
actions
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
This diff is collapsed.
Click to expand it.
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