首页 > 解决方案 > 当 ElasticsearchRequests 太高时设置 AWS cloudwatch 警报

问题描述

我正在尝试设置一个 cloudwatch 警报,如果使用 CloudFormation 将超过 5000 个 http 请求发送到 AWS ES 集群,我看到有ElasticsearchRequests我可以使用的指标,这就是我到目前为止所拥有的:

  ClusterElasticsearchRequestsTooHighAlarm:
    Condition: HasAlertTopic
    Type: 'AWS::CloudWatch::Alarm'
    Properties:
      AlarmActions:
      - {'Fn::ImportValue': !Sub '${ParentAlertStack}-TopicARN'}
      AlarmDescription: 'ElasticsearchRequests are too high.'
      ComparisonOperator: GreaterThanThreshold
      Dimensions:
      - Name: ClientId
        Value: !Ref 'AWS::AccountId'
      - Name: DomainName
        Value: !Ref ElasticsearchDomain
      EvaluationPeriods: 1
      MetricName: 'ElasticsearchRequests'
      Namespace: 'AWS/ES'
      OKActions:
      - {'Fn::ImportValue': !Sub '${ParentAlertStack}-TopicARN'}
      Period: 60
      Statistic: Maximum
      Threshold: 5000

这看起来正确吗?

我应该使用SampleCount而不是MaximumforStatistic吗?

非常感谢任何建议

标签: amazon-cloudformationamazon-cloudwatch

解决方案


根据 AWS Doc about monitoring ES clusters,指标 ElasticsearchRequests 的相关统计数据为Sum.

这是文档所说的:

弹性搜索请求

向 Elasticsearch 集群发出的请求数。

相关统计:Sum


推荐阅读