问题描述
我想使用Boto同时提取多个数据库的RDS Cloudwatch指标.
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']})
这就是我得到的:
[
{
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.
推荐答案
我认为没有任何方法可以完成您要问的事情.您可以指定单个DBInstanceIndentifier
作为维度并获取该DBInstance的特定数据,也可以指定多个DBInstanceIdentifiers
并获取跨那些维度的度量数据汇总,但是我认为没有任何方法可以请求多个单独的维度在一个API调用中.我认为您必须致电您感兴趣的每个特定维度.
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.
这篇关于显示多个实例的RDS指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!