如何使用CloudFormation设置特定Lambda的Lambda警报 [英] How to set lambda alarm for specific lambda using CloudFormation

查看:140
本文介绍了如何使用CloudFormation设置特定Lambda的Lambda警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是来自 AWS文档

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函数总数指标设置了警报,而不是

However, It seems to set an alarm for the total lambda functions metric's figure, not for only specific function and I couldn't find any mention about setting an alarm for a specific function.

如何为特定功能设置警报?

How could I set an alarm for a specific function?

推荐答案

要警报特定lambda函数的指标,您必须设置 FunctionName 维度。

To alarm on a specific lambda function's metric you have to set the FunctionName dimension.

例如:

  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"

这篇关于如何使用CloudFormation设置特定Lambda的Lambda警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆