[英]How do I create CloudWatch Alarms for DocumentDB in Cloudformation
How do I create Cloudwatch alarms in Cloudformation for AWS DocumentDB.如何在 Cloudformation 中为 AWS DocumentDB 创建 Cloudwatch 警报。 There are no examples available.
没有可用的示例。 How to add CPU Utilization alarm on Primary vs Reader instances?
如何在 Primary 实例和 Reader 实例上添加 CPU 使用率警报?
I have tried creating an alarm, but faced issues with differentiating between the Primary vs Reader instance.我曾尝试创建警报,但在区分主实例和读取器实例时遇到了问题。
Can anyone please share a sample yaml/json cloudformation - to build such an alarm.任何人都可以分享一个示例 yaml/json cloudformation - 来构建这样的警报。
To create an alarm for CPU utilization on DocumentDB primary and reader instances using AWS CloudFormation, you could use the following script:要使用 AWS CloudFormation 在 DocumentDB 主实例和读取器实例上创建 CPU 使用率警报,您可以使用以下脚本:
Resources:
DocumentDBPrimaryCPUAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: CPU utilization is high on the DocumentDB primary instance
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
MetricName: CPUUtilization
Namespace: AWS/RDS
Period: 60
Statistic: Average
Threshold: 90
ActionsEnabled: true
AlarmActions:
- arn:aws:sns:<region>:<account-id>:<sns-topic-name>
Dimensions:
- Name: DBInstanceIdentifier
Value: <documentdb-primary-instance-id>
DocumentDBReaderCPUAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: CPU utilization is high on the DocumentDB reader instance
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
MetricName: CPUUtilization
Namespace: AWS/RDS
Period: 60
Statistic: Average
Threshold: 90
ActionsEnabled: true
AlarmActions:
- arn:aws:sns:<region>:<account-id>:<sns-topic-name>
Dimensions:
- Name: DBInstanceIdentifier
Value: <documentdb-reader-instance-id>
The above YAML creates two alarms: one for the primary DocumentDB instance and one for the reader instance.上面的 YAML 创建了两个警报:一个针对主 DocumentDB 实例,一个针对读取器实例。 The alarms monitor the CPU utilization and will trigger an SNS notification if the utilization goes above 90%.
警报监视 CPU 利用率,如果利用率超过 90%,将触发 SNS 通知。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.