I am trying to get alarms attached on RDS instances. But not able to get alarms names of RDS using below AWS CLI command.
aws cloudwatch describe-alarms-for-metric --namespace AWS/RDS --metric-name CPUUtilization --Dimensions Name=DBInstanceIdentifier,Value=My-DB
Getting output:
|DescribeAlarmsForMetric| +-----------------------+
As same aws cli command i am trying to get alarms which are configured on EC2 Instance and its working for me
aws cloudwatch describe-alarms-for-metric --region $region --metric-name StatusCheckFailed --namespace AWS/EC2 --dimensions Name=InstanceId,Value=$i --output text --query 'MetricAlarms[].[AlarmName]'
To reproduce the situation, I did the following:
I then ran the command:
aws cloudwatch describe-alarms-for-metric --namespace AWS/RDS --metric-name CPUUtilization --dimensions Name=DBInstanceIdentifier,Value=stack
The response was:
{
"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"
}
]
}
So, it seems to work fine for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.