几天未调用Lambda函数时,CloudWatch警报会触发吗?

时间:2020-02-13 15:59:01

标签: lambda cloudwatch-alarms

我将cloudwatch警报设置为在lambda故障时触发。我今天收到了警报,但lambda已有14天没有被调用了。 14天前,lambda触发了数千次。

  LambdaMetricFilter: 
    Type: AWS::Logs::MetricFilter
    DependsOn: DataTransferLambdaLambda
    Properties: 
      LogGroupName: !Sub '/aws/lambda/-data-transfer-lambda-${Environment}'
      FilterPattern: "Lambda ERROR Alert"
      MetricTransformations: 
        - 
          MetricValue: "1"
          MetricNamespace: "Lambda/ExecutionFailures"
          MetricName: "LambdaExecutionFailures"
  LambdaCloudWatchAlarm:
    Type: 'AWS::CloudWatch::Alarm'
    Properties:
      EvaluationPeri: '1'
      Statistic: Sum
      Threshold: '0'
      Period: '300'
      AlarmActions: "topic-email-arn"
      AlarmName: !Sub 'data-transfer-lambda-${Environment}'
      AlarmDescription: !Sub 'data-transfer-lambda alarm for Lambda execution failures on ${Environment}.'
      Namespace: Lambda/ExecutionFailures
      ComparisonOperator: GreaterThanThreshold
      MetricName: LambdaExecutionFailures

我收到的错误:

Alarm Details:
- Name:                       data-transfer-lambda
- Description:                data-transfer-lambda alarm for Lambda execution failures on.
- State Change:               INSUFFICIENT_DATA -> ALARM
- Reason for State Change:    Threshold Crossed: 1 datapoint [1.0 (12/02/20 22:31:00)] was greater than the threshold (0.0).
- Timestamp:                  Wednesday 12 February, 2020 22:36:29 UTC
- AWS Account:                1111111111   Threshold:
- The alarm is in the ALARM state when the metric is GreaterThanThreshold 0.0 for 300 seconds.   Monitored Metric:
- MetricNamespace:                     Lambda/ExecutionFailures
- MetricName:                          LambdaExecutionFailures
- Dimensions:
- Period:                              300 seconds
- Statistic:                           Sum
- Unit:                                not specified

    State Change Actions:
- OK:
- ALARM: [arn:aws:sns:us-east-1:1111111111:sns-topic-arn]
- INSUFFICIENT_DATA:

由于没有调用几天,它有INSUFFICIENT_DATA来触发cloudwatch事件吗?如果是这样,我该如何解决?这个lambda会在两周中很少触发一两天,然后在这段时间内会触发很多。

0 个答案:

没有答案