【发布时间】:2013-07-03 18:53:47
【问题描述】:
到目前为止,我已经以这样的方式设置了警报:
dim = new Dimension()
.withName("InstanceId")
.withValue(hashedId);
alarmreq = new PutMetricAlarmRequest()
.withDimensions(dim)
.withMetricName(metricName)
.withNamespace(nameSpace)
.withAlarmName(alarmName)
.withActionsEnabled(true)
.withStatistic(statistic)
.withThreshold(threshold)
.withComparisonOperator("GreaterThanThreshold")
.withPeriod(period)
.withEvaluationPeriods(evaluationPeriods)
.withAlarmActions("arn:aws:sns:us-west-2:xxxxxxxxx:NotifyMe");
gCloudWatch.putMetricAlarm(alarmreq);
这会为执行 SNS NotifyMe 的指定实例创建一个警报。但是,我找不到有关如何添加到此警报或 SNS 以在警报进入 ALARM 状态时停止或终止实例的任何文档。
我拥有的唯一线索是,虽然 .withAlarmActions() 只接受 SNS 或 SQS 操作,但 SNS 可以发出 HTTP 请求,在最坏的情况下我可能能够处理。
我还知道可以将此功能添加到警报中,因为在 AWS Web 界面上,您可以创建停止或终止实例的警报。
【问题讨论】:
标签: java amazon-web-services amazon-ec2 amazon-cloudwatch