简体   繁体   English

控制台与 CLI 创建的 AWS CloudWatch 警报之间的差异

[英]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 使用 CLI 创建时缺少这些

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.

相关问题 AWS.CloudWatch SDK 与 CLI 产生不同的结果 - AWS.CloudWatch SDK vs. CLI produces different results AWS CloudWatch 和 AWS CloudWatch 事件之间的区别 - Difference between AWS CloudWatch and AWS CloudWatch Events S3 指标的巨大差异 - Cloudwatch vs AWS S3 CLI vs UI“Get Size” - Huge varience in S3 Metrics - Cloudwatch vs AWS S3 CLI vs UI 'Get Size' 如何使用 cli 过滤 AWS CloudWatch 日志 - How to filter AWS CloudWatch logs using cli 混淆 aws cloudwatch 旧代理与统一 cloudwatch 代理 - Confusion aws cloudwatch old agent vs unified cloudwatch agent 按多个值/AWS CLI 过滤 AWS CloudWatch 原始日志事件 - Filtering AWS CloudWatch raw log events by multiple values / AWS CLI 有没有办法为 CloudWatch 日志组过滤器生成 AWS 控制台 URL? - Is there a way to generate the AWS Console URLs for CloudWatch Log Group filters? s3:listallbuckets 适用于 aws 控制台,但不适用于 cli - s3:listallbuckets works on aws console but not on cli 为什么 AWS CLI 在 darwin (mac) 和 linux 上使用不同的 AWS 服务? rds describe-db-instances 命令什么时候使用STS? - Why the does AWS CLI use different AWS services on darwin (mac) vs. linux? When does the rds describe-db-instances command use STS? AWS CLI 检索新创建的策略的 ARN - AWS CLI retrieve the ARN of the newly created policy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM