Help Center/ Data Admin Service/ API Reference/ APIs (in OBT)/ Cloud DBA/ Obtaining an Instance Diagnosis Report
Updated on 2024-12-04 GMT+08:00

Obtaining an Instance Diagnosis Report

Function

This API is used to obtain an instance diagnosis report.

URI

GET /v3/{project_id}/instances/{instance_id}/get-instance-health-report

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID To obtain the value, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID

Table 2 Query parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Task ID

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

X-Language

No

String

Language

Enumerated values:

  • zh-cn
  • en-us

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

success

Boolean

Whether the diagnosis in a daily report is successful

start_at

Long

Diagnosis start time (in Unix timestamp format) in a daily report, in milliseconds

end_at

Long

Diagnosis end time (in Unix timestamp format) in a daily report, in milliseconds

task_id

String

Report ID

summary_info

Objects in Table 5

Daily report abstract

instance_info

Table 9 object

Instance information list

performance_stat

Table 10 object

Performance statistics and analysis list

disk_stat

Table 11 object

Disk statistics and analysis list

table_space_stat

Table 14 object

Tablespace statistics and analysis list

slow_log_stat

Table 17 object

Statistics and analysis list of slow SQL queries

full_sql_stat

Table 18 object

Statistics and analysis list of SQL queries in SQL Explorer

inspection_stat

Table 20 object

Statistics and analysis list of preventive maintenance inspection scores

error_message

String

Error message

Table 5 HealthReportSummaryInfo

Parameter

Type

Description

analysis_results

Array of Table 6 objects

Analysis results

Table 6 HealthReportAnalysisResult

Parameter

Type

Description

risk_code

String

Risk code

risk_level

String

Risk level

risk_content

String

Risk content

reasons

Array of Table 7 objects

Possible causes

Table 7 HealthReportRiskReason

Parameter

Type

Description

reason_code

String

Possible cause code

reason_content

String

Possible cause content

suggestions

Array of Table 8 objects

Suggestions

Table 8 HealthReportRiskSuggestion

Parameter

Type

Description

suggestion_code

String

Suggestion codes

suggestion_content

String

Suggestion content

Table 9 HealthReportInstanceInfo

Parameter

Type

Description

tenant_id

String

Account ID

project_id

String

Project ID

instance_id

String

Instance ID

master_node_id

String

Primary node ID

instance_name

String

Instance name

cpu

Integer

Number of CPU cores of an instance

mem

Integer

Instance memory size

disk_size

Integer

Disk size

disk_type

String

Disk type

engine

String

DB engine

engine_version

String

DB engine kernel version

Table 10 HealthReportPerformanceStat

Parameter

Type

Description

peak_stats

Array of Table 12 objects

Peak statistics

ratio_stats

Array of Table 13 objects

Ratio data

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 11 HealthReportDiskStat

Parameter

Type

Description

peak_stats

Array of Table 12 objects

Peak statistics

ratio_stats

Array of Table 13 objects

Ratio data

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 12 HealthReportSingleValueStat

Parameter

Type

Description

metric

String

Metric name

value

Double

Value

max_value

Double

Maximum value

normalized

Double

Normalized value

stage

String

Current status

timestamp

Long

Metric collection time

Table 13 HealthReportRatioStat

Parameter

Type

Description

metric

String

Metric name

max_value

Double

Maximum value

critical_ratio

Double

Critical ratio

medium_ratio

Double

Medium ratio

light_ratio

Double

Light ratio

Table 14 HealthReportTableSpaceStat

Parameter

Type

Description

size_top

Array of Table 15 objects

Top tables in size

rows_top

Array of Table 15 objects

Top table rows

size_incr_top

Array of Table 16 objects

Top tables in size with the highest growth rate

rows_incr_top

Array of Table 16 objects

Top rows with the highest growth rate

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 15 HealthReportTableSpaceInfo

Parameter

Type

Description

database

String

Database name

table

String

Table name

db_engine

String

DB engine

table_size

Long

Table size

data_size

Long

Data size

index_size

Long

Index size

rows

Long

Number of rows

Table 16 HealthReportTableSpaceIncrInfo

Parameter

Type

Description

database

String

Database name

table

String

Table name

increment

Long

Increment

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 17 HealthReportSlowLogStat

Parameter

Type

Description

collect_slow_log

Boolean

Whether slow SQL queries are collected

top_execute_slow_logs

Array of Table 19 objects

Top slow SQL queries executed

top_avg_query_time_slow_logs

Array of Table 19 objects

Top slow SQL queries taking average time

top_max_query_time_slow_logs

Array of Table 19 objects

Top slow SQL queries taking longest

rows_examined_exceeding

Array of Table 19 objects

Top slow SQL queries which return rows

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 18 HealthReportFullSqlStat

Parameter

Type

Description

collect_full_sql

Boolean

Whether SQL Explorer data is collected

execute_top_templates

Array of Table 19 objects

Top executed SQL queries in SQL Explorer

sum_rows_examined_top_templates

Array of Table 19 objects

Top SQL queries scanning rows in SQL Explorer

avg_cost_top_templates

Array of Table 19 objects

Top SQL queries taking average time in SQL Explorer

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 19 HealthReportSqlTemplate

Parameter

Type

Description

template_id

String

Template ID

template

String

Template content

databases

Array of strings

Database list

times

Long

Execution times

avg_query_time

Double

Average execution time

max_query_time

Double

Maximum execution time

avg_rows_examined

Double

Average rows scanned

max_rows_examined

Double

Maximum rows scanned

sum_rows_examined

Double

Total rows scanned

avg_rows_sent

Double

Average rows returned

max_rows_sent

Double

Maximum rows returned

Table 20 HealthReportInspectionStat

Parameter

Type

Description

inspection_score

Array of Table 21 objects

Inspection score

analyze_success

Boolean

Whether analytical and statistical data is collected

error_message

String

Error message

Table 21 HealthReportInspectionScore

Parameter

Type

Description

score

Double

Score

critical

Integer

Major event

medium

Integer

Warning

light

Integer

Optimization

cpu_usage

Double

CPU usage

mem_usage

Double

Memory usage

space_usage

Double

Space usage

connection_rate

Double

Connection usage

iops_usage

Double

IOPS usage

thread_running

Double

Active session

slow_sql_total

Long

Slow SQL queries

lost_points_detail_list

Array of Table 22 objects

Score deduction details

Table 22 HealthReportLostPointsDetail

Parameter

Type

Description

metric

String

Score deduction item

lost_points

Double

Deducted score

risk_level

String

Event level

Status code: 400

Table 23 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 24 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

Obtaining an instance diagnosis report

GET https://das.cn-north-7.myhuaweicloud.com/v3/052041494800d57c2f02c00275b4c247/instances/bcfa975193f1402fa11a6d4fd6baf5fbin01/get-instance-health-report?task_id=bb252ed0-3d06-489a-a662-6609e054e91c

Example Response

Status code: 200

Success

{ 
  "success" : true, 
  "summary_info" : { 
    "analysis_results" : [ { 
      "risk_code" : "SLOW_LOG_ISSUE", 
      "risk_level" : "WARNING", 
      "risk_content": "Slow SQL queries",
      "reasons" : [ { 
        "reason_code" : "SLOW_LOG_EXIST", 
      reason_content": "Slow SQL queries",
        "suggestions" : [ { 
          "suggestion_code" : "ANALYZE_SLOW_LOG", 
           "suggestion_content":"Analyzes slow SQL statements to locate the root cause."
        } ] 
      } ] 
    } ] 
  }, 
  "instance_info" : { 
    "tenant_id" : "05204146e600d48f0f02c002850ec340", 
    "project_id" : "052041494800d57c2f02c00275b4c247", 
    "instance_id" : "bcfa975193f1402fa11a6d4fd6baf5fbin01", 
    "instance_name" : "rds-sql-Do not delete 1.",
    "cpu" : 2, 
    "mem" : 8, 
    "disk_size" : 60, 
    "disk_type" : "CLOUDSSD", 
    "engine" : "mysql", 
    "engine_version" : "5.7" 
  }, 
  "performance_stat" : { 
    "analyze_success" : true, 
    "peak_stats" : [ { 
      "metric" : "qps", 
      "value" : 64.88, 
      "max_value" : 11178, 
      "normalized" : 0.005804258364644837, 
      "stage" : "LIGHT", 
      "timestamp" : 1728756000 
    } ], 
    "ratio_stats" : [ { 
      "metric" : "qps", 
      "max_value" : 11178, 
      "critical_ratio" : 0, 
      "medium_ratio" : 0, 
      "light_ratio" : 1 
    } ] 
  }, 
  "disk_stat" : { 
    "analyze_success" : true, 
    "peak_stats" : [ { 
      "metric" : "iops", 
      "value" : 91.9, 
      "max_value" : 4500, 
      "normalized" : 0.020422222222222224, 
      "stage" : "LIGHT", 
      "timestamp" : 1728750600 
    } ], 
    "ratio_stats" : [ { 
      "metric" : "iops", 
      "max_value" : 4500, 
      "critical_ratio" : 0, 
      "medium_ratio" : 0, 
      "light_ratio" : 1 
    } ] 
  }, 
  "table_space_stat" : { 
    "analyze_success" : true 
  }, 
  "slow_log_stat" : { 
    "analyze_success" : true, 
    "collect_slow_log" : true, 
    "top_execute_slow_logs" : [ { 
      "template_id" : "5B20B6BF446F926F", 
      "template" : "INSERT INTO test123 VALUES (?);", 
      "databases" : [ "test_db" ], 
      "times" : 83, 
      "avg_query_time" : 0.9021538595657752, 
      "max_query_time" : 45.08398997783661, 
      "avg_rows_examined" : 0, 
      "sum_rows_examined" : 0, 
      "avg_rows_sent" : 0 
    } ], 
    "rows_examined_exceeding" : [ ] 
  }, 
  "full_sql_stat" : { 
    "analyze_success" : true, 
    "collect_full_sql" : true, 
    "execute_top_templates" : [ { 
      "template_id" : "B38F825636B24B7", 
      "template" : "CREATE TABLE IF NOT EXISTS table_001 (id int)", 
      "databases" : [ "test_db" ], 
      "times" : 1, 
      "avg_query_time" : 5, 
      "avg_rows_examined" : 0, 
      "sum_rows_examined" : 0 
    } ] 
  }, 
  "inspection_stat" : { 
    "analyze_success" : true, 
    "inspection_score" : [ { 
      "score" : 100, 
      "critical" : 0, 
      "medium" : 0, 
      "light" : 0, 
      "cpu_usage" : 3.93, 
      "mem_usage" : 22.91, 
      "space_usage" : 8.66, 
      "connection_rate" : 0.54, 
      "iops_usage" : 0.28, 
      "thread_running" : 4, 
      "slow_sql_total" : 0, 
      "lost_points_detail_list" : [ { 
        "metric" : "memUsage", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      }, { 
        "metric" : "cpuUsage", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      }, { 
        "metric" : "spaceUsage", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      }, { 
        "metric" : "iopsUsage", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      }, { 
        "metric" : "connectionRate", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      }, { 
        "metric" : "threadRunning", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      }, { 
        "metric" : "slowSqlTotal", 
        "lost_points" : 0, 
        "risk_level" : "NORMAL" 
      } ] 
    } ] 
  } 
}

Status Codes

Status Code

Description

200

Success

400

Client error

500

Server error

Error Codes

See Error Codes.