9 lines
545 B
Bash
9 lines
545 B
Bash
aws rds describe-db-instances | jq -cr '.DBInstances[].DBInstanceIdentifier' | while read i; do
|
|
dbStatus=$(aws rds describe-db-instances --db-instance-identifier $i --query DBInstances[].DBInstanceStatus --output text)
|
|
if [ $dbStatus != "available" ]; then
|
|
aws cloudwatch put-metric-data --metric-name RdsInstanceUnavailable --namespace Custom/RDS --value 1 --dimensions DBInstanceIdentifier=$i
|
|
else
|
|
aws cloudwatch put-metric-data --metric-name RdsInstanceAvailable --namespace Custom/RDS --value 1 --dimensions DBInstanceIdentifier=$i
|
|
fi
|
|
done
|