Skip to content

Alibaba Cloud RDS MySQL

Alibaba Cloud RDS MySQL Metrics display, including CPU usage, memory usage, IOPS, network bandwidth, InnoDB, TPS, QPS, etc.

Configuration

Install Func

It is recommended to enable Guance Integration - Extension - Managed Func

If you deploy Func by yourself, please refer to Self-deployed Func

Enable Script

Tip: Please prepare the required Alibaba Cloud AK in advance (for simplicity, you can directly grant global read-only permission ReadOnlyAccess)

Managed Version Enable Script

  1. Log in to Guance Console
  2. Click on the 【Integration】 menu, select 【Cloud Account Management】
  3. Click 【Add Cloud Account】, choose 【Alibaba Cloud】, fill in the required information on the interface; if you have configured cloud account information before, ignore this step
  4. Click 【Test】, after testing successfully click 【Save】; if the test fails, check whether the related configuration information is correct and retest
  5. Click on the 【Cloud Account Management】 list to see the added cloud account, click the corresponding cloud account, go to the details page
  6. Click the 【Integration】 button on the cloud account detail page, find Alibaba Cloud RDS MySQL under the Not Installed list, click the 【Install】 button, pop up the installation interface and install it.

Manual Enable Script

  1. Log in to the Func console, click 【Script Market】, enter the official script market, search:guance_aliyun_rds

  2. After clicking 【Install】, input the corresponding parameters: Alibaba Cloud AK ID, AK Secret, and account name.

  3. Click 【Deploy Startup Script】, the system will automatically create a Startup script set and configure the corresponding startup script automatically.

  4. After enabling, you can see the corresponding automatic trigger configuration in 「Management / Automatic Trigger Configuration」. Click 【Execute】 to run immediately without waiting for the scheduled time. Wait a moment, you can view the execution task records and corresponding logs.

We default collect some configurations, see metrics section for details.

Configure Custom Cloud Object Metrics

Verification

  1. Confirm in 「Management / Automatic Trigger Configuration」 whether the corresponding tasks exist with automatic trigger configurations, and check task records and logs for any anomalies.
  2. In Guance, 「Infrastructure / Custom」 check if there is asset information.
  3. In Guance, 「Metrics」 check if there is corresponding monitoring data.

Metrics

After configuring Alibaba Cloud - Cloud Monitoring, the default metric set is as follows. You can collect more metrics through configuration. Alibaba Cloud Cloud Monitoring Metric Details

Metric Id Metric Name Dimensions Statistics Unit
ConnectionUsage Connection Usage Rate userId,instanceId Average,Minimum,Maximum %
CpuUsage CPU Usage Rate userId,instanceId Average,Minimum,Maximum %
DiskUsage Disk Usage Rate userId,instanceId Average,Minimum,Maximum %
IOPSUsage IOPS Usage Rate userId,instanceId Average,Minimum,Maximum %
MemoryUsage Memory Usage Rate userId,instanceId Average,Minimum,Maximum %
MySQL_ComDelete MySQL Delete per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ComInsert MySQL Insert per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ComInsertSelect MySQL InsertSelect per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ComReplace MySQL Replace per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ComReplaceSelect MySQL ReplaceSelect per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ComSelect MySQL Select per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ComUpdate MySQL Update per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_DataDiskSize MySQL Data Disk Usage userId,instanceId Average,Maximum,Minimum Megabytes
MySQL_IbufDirtyRatio MySQL_BP Dirty Page Percentage userId,instanceId Average,Maximum,Minimum %
MySQL_IbufReadHit MySQL_BP Read Hit Rate userId,instanceId Average,Maximum,Minimum %
MySQL_IbufRequestR MySQL Logical Reads per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_IbufRequestW MySQL Logical Writes per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_IbufUseRatio MySQL_BP Utilization Rate userId,instanceId Average,Maximum,Minimum %
MySQL_InnoDBDataRead MySQL_InnoDB Data Read per Second userId,instanceId Average,Maximum,Minimum Kbyte
MySQL_InnoDBDataWritten MySQL_InnoDB Data Written per Second userId,instanceId Average,Maximum,Minimum Kbyte
MySQL_InnoDBLogFsync MySQL_InnoDB Log fsync per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InnoDBLogWriteRequests MySQL_InnoDB Log Write Requests per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InnoDBLogWrites MySQL_InnoDB Log Physical Writes per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InnoDBRowDelete MySQL_InnoDB Rows Deleted per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InnoDBRowInsert MySQL_InnoDB Rows Inserted per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InnoDBRowRead MySQL_InnoDB Rows Read per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InnoDBRowUpdate MySQL_InnoDB Rows Updated per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_InstanceDiskSize MySQL Instance Disk Usage userId,instanceId Average,Maximum,Minimum Megabytes
MySQL_LogDiskSize MySQL Log Disk Usage userId,instanceId Average,Maximum,Minimum Megabytes
MySQL_NetworkInNew MySQL Network Inbound Bandwidth userId,instanceId Average,Minimum,Maximum bits/s
MySQL_NetworkOutNew MySQL Network Outbound Bandwidth userId,instanceId Average,Minimum,Maximum bits/s
MySQL_OtherDiskSize MySQL Other Disk Usage userId,instanceId Average,Maximum,Minimum Megabytes
MySQL_QPS MySQL Queries per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_SlowQueries MySQL Slow Queries per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_TPS MySQL Transactions per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_TempDiskTableCreates MySQL Temporary Tables Created per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ThreadsConnected MySQL Threads Connected userId,instanceId Average,Maximum,Minimum count
MySQL_ThreadsRunning MySQL Active Threads userId,instanceId Average,Maximum,Minimum count

Objects

Collected Alibaba Cloud SLB object data structure, which can be seen from 「Infrastructure - Custom」.

{
  "measurement": "aliyun_rds",
  "tags": {
    "name"                 : "rm-xxxxx",
    "DBInstanceType"       : "Primary",
    "PayType"              : "Prepaid",
    "Engine"               : "MySQL",
    "DBInstanceClass"      : "rds.mysql.s2.large",
    "DBInstanceId"         : "rm-xxxxx",
    "ZoneId"               : "cn-shanghai-h",
    "RegionId"             : "cn-shanghai",
    "DBInstanceDescription": "Business System",
    "LockMode"             : "Unlock",
    "Category"             : "Basic",
    "ConnectionMode"       : "Standard",
    "DBInstanceNetType"    : "Intranet",
    "DBInstanceStorageType": "local_ssd",
  },
  "fields": {
    "CreationTime"     : "2022-12-13T16:00:00Z",
    "ExpireTime"       : "2022-12-13T16:00:00Z",
    "DiskUsed"         : "10000",
    "BackupSize"       : "10000",
    "LogSize"          : "10000",
    "BackupLogSize"    : "10000",
    "BackupDataSize"   : "10000",
    "ConnectionString" : "{JSON connection address data}",
    "DBInstanceStorage": "100",
    "accounts"         : "{JSON user permission data}",
    "databases"        : "{JSON database data}",
    "SSLExpireTime"    : "2022-10-11T08:16:43Z",
    "message"          : "{JSON instance data}",
  }
}

Logs

Slow Query Statistics

Prerequisites for Slow Query Statistics

Tip 1: The code execution of this script depends on the collection of RDS instance objects. If RDS custom object collection is not configured, the slow log script cannot collect slow log data. Tip 2: Due to a 6~8 hour delay in returning statistics data from Alibaba Cloud, the collector updating data may also experience delays. Refer to the Alibaba Cloud documentation: Cloud Database RDS Slow Query Statistics for detailed information. Tip 3: This collector supports all versions of MySQL (except the basic version of MySQL 5.7), SQL Server 2008 R2, MariaDB 10.3 types of databases. To collect other types of databases, use the Alibaba Cloud-RDS Slow Query Detail collector.

Installation Script for Slow Query Statistics

On top of the previous setup, you need to install another script corresponding to the RDS Slow Query Statistics Log Collection.

Click and install the corresponding script package in 「Management / Script Market」:

  • 「Guance Integration (Alibaba Cloud - RDS Slow Query Statistics Log Collection)」(ID: guance_aliyun_rds_slowlog)

After data synchronization, you can view the data in the 「Logs」 section of Guance.

An example of the reported data is as follows:

{
  "measurement": "aliyun_rds_slowlog",
  "tags": {
    "name"                 : "rm-xxxxx",
    "DBName"               : "cloudcare_core",
    "DBInstanceId"         : "rm-bp1xxxxxxxxxx",
    "RegionId"             : "cn-hangzhou",
    "DBInstanceType"       : "Primary",
    "PayType"              : "Prepaid",
    "Engine"               : "MySQL",
    "DBInstanceClass"      : "rds.mysql.s2.large",
    "ZoneId"               : "cn-shanghai-h",
    "DBInstanceDescription": "Business System"
  },
  "fields": {
    "SQLHASH"                      : "436f9dd030e0a87920bbcd818b34f271",
    "SQLText"                      : "{SQL Statement}",
    "CreateTime"                   : "2022-06-05Z",
    "SQLServerTotalExecutionTimes" : 0,
    "MaxExecutionTime"             : 1,
    "MaxLockTime"                  : 0,
    "AvgExecutionTime"             : 0,
    "MySQLTotalExecutionTimes"     : 0,
    "SQLServerTotalExecutionTimes" : 1,
    "SQLServerTotalExecutionCounts": 0,
    "MySQLTotalExecutionCounts"    : 0,
    "SQLServerAvgExecutionTime"    : 0,
    "message"                      : "{JSON log data}"
  }
}

Descriptions of some parameters are as follows:

Field Type Description
SQLServerTotalExecutionTimes int SQL Server Execution Duration (Total, Milliseconds)
AvgExecutionTime int Execution Time (Average Value) Unit: Seconds
SQLServerAvgExecutionTime int Execution Time (Average Value) Unit: Seconds
MySQLTotalExecutionTimes int MySQL Execution Time (Total Value) Unit: Seconds
SQLServerTotalExecutionTimes int SQL Server Execution Time (Total Value) Unit: Milliseconds
SQLServerTotalExecutionCounts int SQL Server Execution Count (Total Value)
MySQLTotalExecutionCounts int MySQL Execution Count (Total Value)

Note: Fields such as AvgExecutionTime, SQLServerAvgExecutionTime, SQLServerTotalExecutionTimes, etc., are only supported by SQL Server instances. Note: Fields in tags and fields may change with subsequent updates.

Slow Query Details

Prerequisites for Slow Query Details

Tip: The code execution of this script depends on the collection of RDS instance objects. If RDS custom object collection is not configured, the slow log script cannot collect slow log data.

Installation Script for Slow Query Details

On top of the previous setup, you need to install another script corresponding to the RDS Slow Query Details Log Collection.

Click and install the corresponding script package in 「Management / Script Market」:

  • 「Guance Integration (Alibaba Cloud - RDS Slow Query Details Log Collection)」(ID: guance_aliyun_rds_slowlog_record)

After data synchronization, you can view the data in the 「Logs」 section of Guance.

Configure Cloud Database RDS Slow Query Details

An example of the reported data is as follows:

{
  "measurement": "aliyun_rds_slowlog",
  "tags": {
    "name"                 : "rm-xxxxx",
    "DBName"               : "cloudcare_core",
    "DBInstanceId"         : "rm-bp1xxxxxxxxxx",
    "RegionId"             : "cn-hangzhou",
    "DBInstanceType"       : "Primary",
    "PayType"              : "Prepaid",
    "Engine"               : "MySQL",
    "DBInstanceClass"      : "rds.mysql.s2.large",
    "ZoneId"               : "cn-shanghai-h",
    "DBInstanceDescription": "Business System",
    "HostAddress"          : "xxxx",
    "UserName"             : "xxxx",
    "ClientHostName"       : "xxxx",
    "ApplicationName"      : "xxxx",

  },
  "fields": {
    "SQLHASH"                      : "436f9dd030e0a87920bbcd818b34f271",
    "SQLText"                      : "{SQL Statement}",
    "QueryTimes"                   : 0,
    "QueryTimesMS"                 : 0,
    "ReturnRowCounts"              : 0,
    "ParseRowCounts"               : 0,
    "ExecutionStartTime"           : "2022-02-02T12:00:00Z",
    "CpuTime"                      : 1,
    "RowsAffectedCount"            : 0,
    "LastRowsAffectedCount"        : 0,
    "message"                      : "{JSON log data}"
  }
}

Descriptions of some parameters are as follows:

Field Type Description
QueryTimes int Execution duration. Unit: Seconds (s)
QueryTimesMS int Execution duration. Unit: Milliseconds (ms)
ReturnRowCounts int Returned row count
ParseRowCounts int Parsed row count
ExecutionStartTime str Execution start time
CpuTime int CPU processing duration
RowsAffectedCount int Affected row count
LastRowsAffectedCount int Affected row count of the last statement

Note: Fields such as CpuTime, RowsAffectedCount, LastRowsAffectedCount are only supported by SQL Server instances. Note: Fields in tags and fields may change with subsequent updates. Tip: fields.message is a JSON serialized string.

Feedback

Is this page helpful? ×