Skip to content

Commit 455f5c4

Browse files
committed
auto lookup sns arn
1 parent 9a7788b commit 455f5c4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
# MONITORING
3737
AUTO_MONITOR = 'True'
38-
MONITOR_SNS = 'arn:aws:sns:us-east-1:123456789123:Monitor' # Only necessary if auto-monitoring
3938

4039
# CLOUDWATCH DASHBOARD CREATION
4140
CREATE_DASHBOARD = 'True' # Create a dashboard in Cloudwatch for run

run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,14 @@ def startCluster():
658658
"ApproximateNumberOfMessagesNotVisible",
659659
"ApproximateNumberOfMessagesVisible",
660660
]
661+
sns = boto3.client("sns")
662+
MonitorARN = sns.create_topic(Name="Monitor") # returns ARN since topic already exists
661663
for metric in metricnames:
662664
response = cloudwatch.put_metric_alarm(
663665
AlarmName=f'{metric}isZero_{APP_NAME}',
664666
ActionsEnabled=True,
665667
OKActions=[],
666-
AlarmActions=[MONITOR_SNS],
668+
AlarmActions=[MonitorARN],
667669
InsufficientDataActions=[],
668670
MetricName=metric,
669671
Namespace="AWS/SQS",

0 commit comments

Comments
 (0)