2 réponses
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
Hi,
Here you go. This will print out a list of the Minimum FreeStorageSpace in Bytes for the last 15 minutes (5 minute intervals). You will need to modify the DBInstanceIdentifier Value to match your database instance indentifier...
import boto3
from datetime import datetime,timedelta
import json
# Create CloudWatch client
cloudwatch = boto3.client('cloudwatch')
response = cloudwatch.get_metric_data(
MetricDataQueries=[
{
'Id': 'fetching_FreeStorageSpace',
'MetricStat': {
'Metric': {
'Namespace': 'AWS/RDS',
'MetricName': 'FreeStorageSpace',
'Dimensions': [
{
"Name": "DBInstanceIdentifier",
"Value": "database-1"
}
]
},
'Period': 300,
'Stat': 'Minimum'
}
}
],
StartTime=(datetime.now() - timedelta(seconds=300 * 3)).timestamp(),
EndTime=datetime.now().timestamp(),
ScanBy='TimestampDescending'
)
print(response['MetricDataResults'][0]['Values'])
Hope this helps!
-randy
répondu il y a 5 ans
Contenus pertinents
- demandé il y a 4 mois
- demandé il y a un an
- demandé il y a 7 mois
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an