[英]Differences between AWS CloudWatch alarms created by Console vs. CLI
I Have created simple AWS cloudwatch alarm with console.我已经使用控制台创建了简单的 AWS cloudwatch 警报。 It is triggered by metric "Cognito-By UserPoolAndUserPoolClient-SignInSuccesses".它由指标“Cognito-By UserPoolAndUserPoolClient-SignInSuccesses”触发。 It works as supposed and sends an email via SNS Topic.它按预期工作并通过 SNS 主题发送 email。 I tried to create same alarm with CLI, but it doesn't work.我尝试使用 CLI 创建相同的警报,但它不起作用。 Alarm doesn't get triggered.警报不会被触发。 I compared in console what is difference between those two alarms.我在控制台中比较了这两个警报之间的区别。 When creating alarm with console in metric selection I see metric with information "UserPool" and "UserPoolClient".在指标选择中使用控制台创建警报时,我看到带有信息“UserPool”和“UserPoolClient”的指标。 When using CLI command there isn't parameters to set those two.当使用 CLI 命令时,没有参数来设置这两个。 How could I configure new alarm with CLI so that it is identical to one created in console?我如何使用 CLI 配置新警报,使其与在控制台中创建的警报相同?
CLI command: CLI 命令:
aws cloudwatch put-metric-alarm --alarm-name NewSignupAlarm --alarm-description "New Signup have been done." aws cloudwatch put-metric-alarm --alarm-name NewSignupAlarm --alarm-description “新注册已完成。” --alarm-actions arn:aws:sns:eu-west-3:681278469643:NewTestTopic --metric-name SignUpSuccesses --namespace AWS/Cognito --statistic Sum --period 300 --unit Count --evaluation-periods 1 --threshold 0 --comparison-operator GreaterThanThreshold --profile user3 --alarm-actions arn:aws:sns:eu-west-3:681278469643:NewTestTopic --metric-name SignUpSuccesses --namespace AWS/Cognito --statistic Sum --period 300 --unit Count --evaluation-periods 1 --threshold 0 --comparison-operator GreaterThanThreshold --profile user3
These values are dimensions on the metric.这些值是指标的维度。 You can specify them with the --dimensions
parameter, like this:您可以使用--dimensions
参数指定它们,如下所示:
--dimensions Name=UserPool,Value=eu-west-3_... Name=UserPoolClient,Value=117...
Make sure the values are exact, I used ...
just to illustrate the usage.确保值是准确的,我使用...
只是为了说明用法。
See here for more info on all different parameters that you may need to set if you want the alarm be the same as the one created in the console: https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-metric-alarm.html如果您希望警报与在控制台中创建的警报相同,请参阅此处了解有关您可能需要设置的所有不同参数的更多信息: https://docs.aws.amazon.com/cli/latest/reference/cloudwatch /put-metric-alarm.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.