我猜 PutMetricAlarm 是解决方案。 http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricAlarm.html
我试过这个:
Dimension instance = new Dimension();
instance.Name = "InstanceId";
instance.Value = "<i-02e1d855>";
PutMetricAlarmRequest sample =new PutMetricAlarmRequest();
sample.Dimensions.Add(instance);
sample.AlarmName = "SSample";
sample.ComparisonOperator = "LessThanThreshold";
sample.Threshold = .10;
sample.Statistic = "Average";
sample.Period = 300;
sample.EvaluationPeriods = 3;
sample.MetricName = "Metric Name";
sample.Namespace = "name space";
sample.Unit="Percent";
PutMetricAlarmResponse sampleres = cloudwatch.PutMetricAlarm(sample);
但什么也没发生。我做错什么了吗?以及如何添加 AlarmActions?当警报触发时,这将终止我的实例。
请帮忙。谢谢
谢谢。