开发者社区> 问答> 正文

利用阿里云API查看实例性能数据

# -*- coding: utf-8 -*-
import aliyun.api

# Access Key ID和Access Key Secret
aliyun.setDefaultAppInfo("Access Key ID", "Access Key Secret")

# 请输入RDS所在区域,如cn-hangzhou
my_diqu = "cn-qingdao"

# 请输入RDS实例ID
my_rdsname = "实例ID"

# 请输入开始日期如2015-04-01
my_begintime = "2015-04-28" + "T00:00Z"

# 请输入结束日期如2015-04-28
my_overtime = "2015-04-28" + "T00:30Z"

# 请输入MySQL性能参数表的API参数名
Keys = "MySQL_InnoDBDataReadWriten"

a = aliyun.api.Rds20140815DescribeDBInstancePerformanceRequest()
a.RegionId = my_diqu
a.DBInstanceid = my_rdsname
a.StartTime = my_begintime
a.EndTime =  my_overtime
a.Key = Keys


try:
        my_full = a.getResponse()
        if("Code" in my_full):
                print("Fasle")
                print(my_full["Code"])
                print(my_full["Message"])
        else:
                my_full = a.getResponse()
                print my_full
except Exception,e:
        print(e)

展开
收起
helix 2015-04-28 18:00:04 8552 0
1 条回答
写回答
取消 提交回答
  • 您的帖子很精彩!希望很快能再分享您的下一帖!
    2015-04-29 15:30:29
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Boot2.0实战Redis分布式缓存 立即下载
CUDA MATH API 立即下载
API PLAYBOOK 立即下载