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 TrueWatch Integration - Extensions - DataFlux Func (Automata)

If you want to deploy Func yourself, refer to Self-deploying Func

Enable Script

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

Enable Script for Automata

  1. Log in to the TrueWatch Console
  2. Click the 【Integration】 menu and select 【Cloud Account Management】
  3. Click 【Add Cloud Account】, select 【Alibaba Cloud】, and fill in the required information on the interface. If you have already configured the cloud account information, you can skip this step.
  4. Click 【Test】, and if the test is successful, click 【Save】. If the test fails, please check whether the relevant configuration information is correct and test again.
  5. Click 【Cloud Account Management】 to see the added cloud account in the list. Click the corresponding cloud account to enter the details page.
  6. Click the 【Integration】 button on the cloud account details page, find Alibaba Cloud RDS MySQL under the Not Installed list, and click the 【Install】 button to pop up the installation interface for installation.

Enable Script Manually

  1. Log in to the Func Console, click 【Script Market】, enter the TrueWatch Script Market, and search for: integration_alibabacloud_rds

  2. Click 【Install】, then enter the corresponding parameters: Alibaba Cloud AK ID, AK Secret, and account name.

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

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

Verification

  1. Confirm whether the corresponding task exists in the automatic trigger configuration in 「Management / Automatic Trigger Configuration」, and check the corresponding task records and logs to see if there are any exceptions.
  2. In TrueWatch, check whether the asset information exists in 「Infrastructure / Custom」.
  3. In TrueWatch, check whether there is corresponding monitoring data in 「Metrics」.

Metrics

After configuring Alibaba Cloud Cloud Monitor, the default Measurement is as follows. More metrics can be collected through configuration. Alibaba Cloud Cloud Monitor Metrics Details

Metric Id Metric Name Dimensions Statistics Unit
ConnectionUsage Connection Usage Rate userId,instanceId Average,Minimum,Maximum %
CpuUsage CPU Usage userId,instanceId Average,Minimum,Maximum %
DiskUsage Disk Usage userId,instanceId Average,Minimum,Maximum %
IOPSUsage IOPS Usage userId,instanceId Average,Minimum,Maximum %
MemoryUsage Memory Usage 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 Ratio 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 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 Table Creates per Second userId,instanceId Average,Maximum,Minimum countSecond
MySQL_ThreadsConnected MySQL_Thread Connections userId,instanceId Average,Maximum,Minimum count
MySQL_ThreadsRunning MySQL_Active Threads userId,instanceId Average,Maximum,Minimum count

Objects

The collected Alibaba Cloud SLB object data structure can be seen in 「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" : "{Connection Address JSON Data}",
    "DBInstanceStorage": "100",
    "accounts"         : "{User Permission Information JSON Data}",
    "databases"        : "{Database Information JSON Data}",
    "SSLExpireTime"    : "2022-10-11T08:16:43Z",
    "message"          : "{Instance JSON Data}",
  }
}

Logs

Slow Query Statistics

Prerequisites for Slow Query Statistics

Note 1: The code execution of this script depends on the collection of RDS instance objects. If the custom object collection of RDS is not configured, the slow log script cannot collect slow log data. Note 2: Due to the 6~8 hours delay in Alibaba Cloud statistical data return, the collector update data may be delayed. For details, refer to the Alibaba Cloud documentation: Cloud Database RDS Query Slow Log Statistics. Note 3: This collector supports all versions of MySQL (except MySQL 5.7 Basic Edition), SQL Server 2008 R2, and MariaDB 10.3 databases.

Install Script for Slow Query Statistics

On the previous basis, you need to install a corresponding RDS Slow Query Statistics Log Collection Script.

In 「Management / Script Market」, click and install the corresponding script package:

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

After the data is synchronized normally, you can view the data in the 「Logs」 of TrueWatch.

The reported data example 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"                      : "{Log JSON Data}"
  }
}

Partial parameter descriptions are as follows:

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

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

Slow Query Details

Prerequisites for Slow Query Details

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

Install Script for Slow Query Details

On the previous basis, you need to install a corresponding RDS Slow Query Details Log Collection Script.

In 「Management / Script Market」, click and install the corresponding script package:

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

After the data is synchronized normally, you can view the data in the 「Logs」 of TrueWatch.

The reported data example 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"                      : "{Log JSON Data}"
  }
}

Partial parameter descriptions are as follows:

Field Type Description
QueryTimes int Execution Duration. Unit: seconds (s)
QueryTimesMS int Execution Duration. Unit: milliseconds (ms)
ReturnRowCounts int Returned Rows
ParseRowCounts int Parsed Rows
ExecutionStartTime str Execution Start Time
CpuTime int CPU Processing Duration
RowsAffectedCount int Affected Rows
LastRowsAffectedCount int Last Statement Affected Rows

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