这是AWS document中CloudFormation警报的结构。
Type: "AWS::CloudWatch::Alarm"
Properties:
ActionsEnabled: Boolean
AlarmActions:
- String
AlarmDescription: String
AlarmName: String
ComparisonOperator: String
Dimensions:
- Dimension
EvaluateLowSampleCountPercentile: String
EvaluationPeriods: Integer
ExtendedStatistic: String
InsufficientDataActions:
- String
MetricName: String
Namespace: String
OKActions:
- String
Period: Integer
Statistic: String
Threshold: Double
TreatMissingData: String
Unit: String
但是,似乎为lambda函数总数指标设置了警报,而不仅仅是为特定功能设置了警报,我找不到提及为特定功能设置警报的信息。
如何设置特定功能的警报?
答案 0 :(得分:8)
要对特定的lambda函数的度量标准发出警报,您必须设置FunctionName
维度。
例如:
MyNewAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "AlarmNameGoesHere"
AlarmDescription: "Alarm if lambda errors out too many times"
Namespace: "AWS/Lambda"
MetricName: "Errors"
Dimensions:
- Name: "FunctionName"
Value: "NameOfYourLambdaFunction"
Statistic: "Sum"
ComparisonOperator: "GreaterThanThreshold"
Threshold: 0
EvaluationPeriods: 5
Period: 60
TreatMissingData: "breaching"