我正在尝试在RDS实例上附加警报。但是无法使用以下AWS CLI命令获取RDS的警报名称。
aws cloudwatch describe-alarms-for-metric --namespace AWS/RDS --metric-name CPUUtilization --Dimensions Name=DBInstanceIdentifier,Value=My-DB
获取输出:
| DescribeAlarmsForMetric | + ----------------------- +
与aws cli命令一样,我试图获取在EC2实例上配置的警报及其对我有用的
aws cloudwatch describe-alarms-for-metric --region $region --metric-name StatusCheckFailed --namespace AWS/EC2 --dimensions Name=InstanceId,Value=$i --output text --query 'MetricAlarms[].[AlarmName]'
答案 0 :(得分:1)
为了重现这种情况,我做了以下事情:
然后我运行命令:
aws cloudwatch describe-alarms-for-metric --namespace AWS/RDS --metric-name CPUUtilization --dimensions Name=DBInstanceIdentifier,Value=stack
答复为:
{
"MetricAlarms": [
{
"EvaluationPeriods": 1,
"TreatMissingData": "missing",
"AlarmArn": "...",
"StateUpdatedTimestamp": "2019-02-13T01:21:52.988Z",
"AlarmConfigurationUpdatedTimestamp": "2019-02-13T01:21:52.421Z",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"AlarmActions": [],
"Namespace": "AWS/RDS",
"AlarmDescription": "stack",
"StateReasonData": "...",
"Period": 300,
"StateValue": "ALARM",
"Threshold": 0.0,
"AlarmName": "stack-alarm",
"Dimensions": [
{
"Name": "DBInstanceIdentifier",
"Value": "stack"
}
],
"Statistic": "Average",
"StateReason": "Threshold Crossed: 1 datapoint [2.1557377049180277 (13/02/19 01:16:00)] was greater than or equal to the threshold (0.0).",
"InsufficientDataActions": [],
"OKActions": [],
"ActionsEnabled": true,
"MetricName": "CPUUtilization"
}
]
}
所以,这似乎对我来说很好。