Skip to content

Commit 7cbe554

Browse files
committed
Set up alerts for the OnFailure queue
1 parent f5eaca4 commit 7cbe554

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

serverless.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,53 @@ functions:
118118
resources:
119119
Resources:
120120

121+
AlarmTopic:
122+
Type: AWS::SNS::Topic
123+
124+
AlarmTopicSubscription:
125+
Type: AWS::SNS::Subscription
126+
Properties:
127+
Endpoint: Obayuwanap@gmail.com
128+
Protocol: email
129+
TopicArn: !Ref AlarmTopic
130+
131+
OnFailureQueueAlarm:
132+
Type: AWS::CloudWatch::Alarm
133+
Properties:
134+
AlarmName: '[${sls:stage}] [NotifyRestaurant function] Failed events detected in OnFailure destination'
135+
MetricName: ApproximateNumberOfMessagesVisible
136+
Namespace: AWS/SQS
137+
Statistic: Maximum
138+
Period: 300
139+
EvaluationPeriods: 1
140+
Threshold: 0
141+
ComparisonOperator: GreaterThanThreshold
142+
TreatMissingData: notBreaching
143+
Dimensions:
144+
- Name: QueueName
145+
Value: !GetAtt OnFailureQueue.QueueName
146+
AlarmActions:
147+
- !Ref AlarmTopic
148+
149+
DestinationDeliveryFailuresAlarm:
150+
Type: AWS::CloudWatch::Alarm
151+
Properties:
152+
AlarmName: '[${sls:stage}] [NotifyRestaurant function] Failed to deliver failed events to OnFailure destination'
153+
MetricName: DestinationDeliveryFailures
154+
Namespace: AWS/Lambda
155+
Statistic: Average
156+
Period: 300
157+
EvaluationPeriods: 1
158+
Threshold: 0
159+
ComparisonOperator: GreaterThanThreshold
160+
TreatMissingData: notBreaching
161+
Dimensions:
162+
- Name: FunctionName
163+
Value: !Ref NotifyDashrestaurantLambdaFunction
164+
AlarmActions:
165+
- !Ref AlarmTopic
166+
167+
121168
OnFailureQueue:
122169
Type: AWS::SQS::Queue
123170

0 commit comments

Comments
 (0)