查看实例性能数据

最近更新时间:2017-11-21 18:01:38

1. 接口描述

本接口(CdbTdsqlGetPerformanceInfo)用于查看数据库实例当前性能数据。
接口请求域名:tdsql.api.qcloud.com

2. 输入参数

以下请求参数列表仅列出了接口请求参数,正式调用时需要加上公共请求参数,见公共参数。其中,此接口的Action字段为CdbTdsqlGetPerformanceInfo。

参数名称 必选 类型 描述
cdbInstanceId Int 实例ID
shardId Int 分片id, 0的时候表示获取整个集群的监控或者单机实例的监控
startTime date 开始日期,格式yyyy-mm-dd
endTime date 结束日期,格式yyyy-mm-dd

3. 输出参数

公共返回值结构在返回值可以查看,此处只列出data字段的返回值格式。

返回值为对应性能的点阵。
按时间顺序先后返回各个时间段的数据值,连续时间段如果值相同将被合并为{段数,值}的形式。比如[2,3]就表示连续2个时间段的值为3,一个时间段的长度由请求的开始时间和结束时间的差值决定,小于1天是5分钟一段,大于1天小于7天是30分钟一段,大于7天是2个小时一段。

指标列表

指标名 含义
conn_active 活跃连接数
delete_total 删除操作数DELETE
disk_iops 磁盘每秒IO次数
insert_total 插入操作数INSERT
is_master_switched 是否发生主备切换,1为发生,0否
long_query 慢查询数
mem_hit_rate 缓存命中率
select_total 查询操作数SELECT
update_total 更新操作数UPDATE
slave_delay 主备延迟

4. 错误码表

以下是本接口常见的错误码,如果有不在此列的错误请查阅TDSQL错误码表

错误码 描述
BaradError Barad错误
NoInstanceFound 实例不存在
InnerSystemError 内部系统错误,和业务无关
InstanceStatusError 实例状态错误
ShardNotExist 分片不存在
MetricNotExist 指定的维度不存在
OssOpertaionFailed OSS内部失败
MakeRequestFailed 拼接请求时发生错误
BadRequest 发起请求错误
ReadDataFailed 读取返回数据错误
NoDataFetched 未拉取到数据
JsonUnmarshaFailed json 解析错误
NoDataFetched 未拉取到数据
BaradError Barad数据合并错误

5. 示例

输入

https://tdsql.api.qcloud.com/v2/index.php?
&<公共请求参数>
&Action=CdbTdsqlGetPerformanceInfo
&cdbInstanceId=40732
&startTime=2016-07-17
&endTime=2016-07-18

输出

{
    "code": 0,
    "message": "",
    "codeDesc": "Success",
    "data": {
        "conn_active": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    5,
                    6
                ],
                7,
                [
                    26,
                    6
                ],
                7,
                [
                    182,
                    6
                ],
                [
                    5,
                    7
                ],
                [
                    9,
                    10
                ],
                [
                    2,
                    12
                ],
                [
                    6,
                    13
                ],
                [
                    2,
                    14
                ],
                16,
                17,
                [
                    2,
                    19
                ],
                [
                    2,
                    21
                ],
                20,
                22,
                [
                    3,
                    25
                ],
                [
                    5,
                    24
                ],
                26,
                [
                    2,
                    24
                ],
                [
                    30,
                    null
                ]
            ]
        },
        "delete_total": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    258,
                    0
                ],
                [
                    30,
                    null
                ]
            ]
        },
        "disk_iops": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                3.76,
                4.81,
                4.16,
                3.83,
                5.15,
                4.48,
                4.18,
                6.8,
                3.83,
                3.5,
                4.39,
                4.16,
                4.7,
                3.91,
                6,
                3.75,
                3.68,
                3.67,
                4.57,
                6.24,
                3.6,
                8.24,
                6.24,
                5.52,
                3.64,
                3.34,
                4.88,
                3.91,
                7.43,
                3.51,
                8.57,
                9.54,
                6.48,
                4.54,
                4.16,
                6.78,
                3.6,
                3.59,
                8.75,
                4.39,
                4.72,
                6.28,
                4.16,
                4.26,
                4.7,
                4.86,
                3.34,
                4.71,
                4.21,
                8.09,
                7.87,
                8.06,
                4.56,
                3.28,
                4.15,
                3.65,
                3.84,
                5.76,
                4.48,
                4.96,
                3.59,
                4.08,
                4,
                3.76,
                7.07,
                3.44,
                8.44,
                3.79,
                3.84,
                2.94,
                4.96,
                3.6,
                3.44,
                4.64,
                6.39,
                3.57,
                4.48,
                6.89,
                3.5,
                3.04,
                3.68,
                5.36,
                7.49,
                3.26,
                8.01,
                6.08,
                3.44,
                4.08,
                3.12,
                4.04,
                4,
                7.98,
                4.64,
                3.68,
                2.87,
                2.8,
                3.27,
                3.36,
                4.48,
                5.26,
                3.76,
                3.51,
                5.52,
                4.62,
                4.7,
                3.99,
                4.81,
                3.28,
                4.23,
                3.83,
                4.48,
                3.76,
                8.12,
                7.5,
                4.65,
                3.72,
                3.66,
                4.72,
                3.6,
                3.28,
                4.87,
                3.04,
                4.4,
                3.76,
                8.15,
                4.16,
                3.56,
                4.15,
                4.08,
                7.84,
                6.17,
                6.3,
                2.72,
                4.33,
                3.37,
                7.64,
                3.68,
                4.07,
                4.48,
                4.32,
                7.68,
                [
                    2,
                    3.75
                ],
                5.99,
                10.09,
                4.16,
                5.26,
                5.29,
                4,
                7.77,
                3.84,
                3.8,
                3.87,
                4.78,
                8.68,
                5.36,
                3.75,
                3.48,
                3.75,
                3.44,
                8.1,
                3.6,
                3.47,
                6.21,
                3.5,
                7.93,
                5.18,
                3.92,
                3.5,
                4.16,
                3.98,
                4.9,
                [
                    2,
                    3.92
                ],
                3.34,
                4.41,
                4.08,
                7.96,
                3.35,
                3.73,
                3.04,
                6.95,
                4.55,
                3.28,
                4.88,
                5.03,
                2.64,
                3.28,
                10.39,
                3.51,
                7.59,
                3.17,
                6.38,
                4.48,
                3.44,
                3.84,
                3.85,
                8.56,
                4.08,
                4.22,
                7.69,
                3.36,
                3.91,
                7.37,
                3.59,
                5.02,
                5.11,
                7.5,
                4.16,
                3.04,
                7.43,
                4,
                [
                    2,
                    3.52
                ],
                4.07,
                2.72,
                5.52,
                3.09,
                4.48,
                7.28,
                3.93,
                4.22,
                4.09,
                5.58,
                3.44,
                4.96,
                5.6,
                3.28,
                5.34,
                2.79,
                3.5,
                100.05,
                3.02,
                8.47,
                3.29,
                4.7,
                6.63,
                2.72,
                3.75,
                3.36,
                3.03,
                3.73,
                3.74,
                5.73,
                6.64,
                2.79,
                3.39,
                9.06,
                4.48,
                7.5,
                3.59,
                4.56,
                3.26,
                3.84,
                3.03,
                5.28,
                3.36,
                2.64,
                [
                    30,
                    null
                ]
            ]
        },
        "insert_total": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    258,
                    0
                ],
                [
                    30,
                    null
                ]
            ]
        },
        "is_master_switched": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    258,
                    0
                ],
                [
                    30,
                    null
                ]
            ]
        },
        "long_query": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    231,
                    0
                ],
                6,
                [
                    26,
                    0
                ],
                [
                    30,
                    null
                ]
            ]
        },
        "mem_hit_rate": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    258,
                    99
                ],
                [
                    30,
                    null
                ]
            ]
        },
        "select_total": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                1.45,
                1.55,
                [
                    2,
                    1.47
                ],
                1.45,
                1.53,
                1.55,
                1.45,
                1.43,
                [
                    3,
                    1.55
                ],
                [
                    2,
                    1.45
                ],
                [
                    2,
                    1.55
                ],
                1.53,
                1.45,
                1.42,
                1.47,
                1.43,
                1.42,
                [
                    2,
                    1.45
                ],
                1.42,
                1.53,
                1.52,
                1.43,
                [
                    4,
                    1.45
                ],
                1.42,
                1.43,
                1.42,
                1.45,
                [
                    2,
                    1.47
                ],
                1.45,
                1.55,
                [
                    2,
                    1.45
                ],
                1.43,
                [
                    3,
                    1.42
                ],
                [
                    2,
                    1.43
                ],
                [
                    2,
                    1.42
                ],
                [
                    2,
                    1.45
                ],
                1.42,
                1.43,
                1.47,
                1.43,
                1.45,
                1.53,
                1.5,
                1.47,
                1.43,
                1.42,
                1.45,
                1.55,
                1.45,
                1.47,
                1.45,
                1.47,
                1.45,
                [
                    2,
                    1.47
                ],
                1.55,
                [
                    5,
                    1.45
                ],
                [
                    3,
                    1.42
                ],
                [
                    2,
                    1.43
                ],
                [
                    3,
                    1.45
                ],
                1.43,
                1.42,
                [
                    2,
                    1.43
                ],
                [
                    4,
                    1.42
                ],
                1.43,
                1.5,
                1.53,
                1.55,
                1.52,
                [
                    2,
                    1.55
                ],
                1.5,
                1.43,
                1.42,
                [
                    3,
                    1.45
                ],
                1.47,
                1.45,
                [
                    2,
                    1.47
                ],
                1.42,
                [
                    2,
                    1.55
                ],
                1.42,
                1.45,
                1.43,
                1.42,
                1.45,
                1.42,
                1.43,
                [
                    2,
                    1.45
                ],
                1.55,
                1.53,
                [
                    3,
                    1.55
                ],
                1.47,
                [
                    3,
                    1.45
                ],
                1.47,
                1.42,
                1.45,
                1.5,
                1.53,
                1.5,
                1.43,
                [
                    2,
                    1.47
                ],
                [
                    2,
                    1.43
                ],
                [
                    2,
                    1.47
                ],
                1.45,
                [
                    6,
                    1.42
                ],
                [
                    3,
                    1.53
                ],
                1.42,
                [
                    2,
                    1.45
                ],
                [
                    2,
                    1.53
                ],
                1.45,
                1.47,
                [
                    3,
                    1.45
                ],
                1.42,
                [
                    2,
                    1.55
                ],
                1.53,
                1.55,
                [
                    2,
                    1.47
                ],
                1.42,
                1.45,
                1.55,
                [
                    2,
                    1.47
                ],
                1.42,
                1.45,
                [
                    3,
                    1.47
                ],
                [
                    2,
                    1.45
                ],
                1.47,
                1.43,
                [
                    2,
                    1.45
                ],
                [
                    2,
                    1.47
                ],
                1.43,
                1.42,
                1.53,
                1.55,
                [
                    2,
                    1.47
                ],
                [
                    2,
                    1.42
                ],
                1.47,
                1.55,
                [
                    2,
                    1.53
                ],
                1.55,
                1.45,
                [
                    2,
                    1.42
                ],
                1.43,
                1.42,
                1.43,
                [
                    3,
                    1.55
                ],
                [
                    3,
                    1.45
                ],
                [
                    2,
                    1.53
                ],
                [
                    2,
                    1.55
                ],
                1.45,
                1.47,
                1.52,
                1.43,
                1.42,
                1.43,
                1.52,
                1.53,
                1.55,
                [
                    2,
                    1.42
                ],
                1.47,
                1.42,
                1.52,
                1.48,
                1.47,
                1.43,
                1.45,
                [
                    2,
                    1.47
                ],
                1.45,
                1.47,
                1.45,
                1.48,
                1.45,
                1.5,
                1.47,
                1.45,
                1.48,
                1.55,
                1.45,
                [
                    3,
                    1.42
                ],
                1.45,
                [
                    2,
                    1.43
                ],
                1.5,
                1.47,
                1.48,
                [
                    30,
                    null
                ]
            ]
        },
        "update_total": {
            "StartTime": "2016-07-17 00:00:00",
            "EndTime": "2016-07-18 23:59:59",
            "Data": [
                [
                    258,
                    0
                ],
                [
                    30,
                    null
                ]
            ]
        }
    }
}