Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show RDS Metrics for multiple instances

I would like to pull RDS Cloudwatch Metrics using Boto for multiple databases at once.

So far I have only been able to get metrics for only one instance at a time using an approach like this:

botoRDS = boto.connect_cloudwatch(aws_access_key_id=Key, aws_secret_access_key=OtherKey)

instanceStats = botoRDS.get_metric_statistics(period=60, 
                start_time=self.startTime,
                end_time=self.endTime, 
                namespace="AWS/RDS", 
                metric_name='CPUUtilization', 
                statistics=["Average"],
                dimensions={'DBInstanceIdentifier':['DB1','DB2']})

This is what I get:

[
{
    u'Timestamp': datetime.datetime(2034,1,14,21,2),
    u'Average': 45.1,
    u'Unit': u'Percent'
}]

What I would like to be able to return is the average for both the database seperately. Something like this:

[
{
    u'Timestamp': datetime.datetime(2034,1,14,21,2),
    u'DBInstanceID':'DB1',
    u'Average': 33.02,
    u'Unit': u'Percent'
},
{
   u'Timestamp': datetime.datetime(2034,1,14,21,2),
   u'DBInstanceID':'DB2',
    u'Average': 45.1,
    u'Unit': u'Percent'
}

]

Is it possible to form the dimension specified to get results like this. I would really like to not have to pull data for every DB.

like image 251
RileyJ Avatar asked Oct 21 '22 13:10

RileyJ


1 Answers

I don't think there is any way to do what you are asking. You can specify a single DBInstanceIndentifier as the dimension and get specific data for that DBInstance or you can specify multiple DBInstanceIdentifiers and get metric data aggregated across those dimensions but I don't think there is any way to request multiple, separate dimensions in a single API call. I think you have to make a call for each specific dimension you are interested in.

like image 130
garnaat Avatar answered Oct 23 '22 03:10

garnaat