Alibaba Cloud PolarDB MySQL¶
Alibaba Cloud PolarDB MySQL Metrics, including CPU usage, memory hit rate, network traffic, connections, QPS, TPS, read-only node latency, etc.
Configuration¶
Install Func¶
It is recommended to enable TrueWatch Integration - Extensions - DataFlux Func (Automata)
If you need to deploy Func yourself, refer to Self-deploy Func
Enable Script¶
Note: Please prepare the Alibaba Cloud AK in advance (for simplicity, you can grant the global read-only permission
ReadOnlyAccess
)
Enable Script for DataFlux Func (Automata)¶
- Log in to the TrueWatch console
- Click the 【Integration】 menu and select 【Cloud Account Management】
- Click 【Add Cloud Account】, select 【Alibaba Cloud】, and fill in the required information on the interface. If the cloud account information has been configured before, ignore this step
- Click 【Test】, if the test is successful, click 【Save】. If the test fails, please check the relevant configuration information and test again
- Click 【Cloud Account Management】, and you can see the added cloud account in the list. Click the corresponding cloud account to enter the details page
- Click the 【Integration】 button on the cloud account details page, find
Alibaba Cloud PolarDB MYSQL
in theNot Installed
list, and click the 【Install】 button. The installation interface will pop up for installation.
Enable Script Manually¶
-
Log in to the Func console, click 【Script Market】, enter the TrueWatch script market, and search for:
integration_alibabacloud_polardb
-
Click 【Install】, then enter the corresponding parameters: Alibaba Cloud AK ID, AK Secret, and account name.
-
Click 【Deploy Startup Script】, the system will automatically create the
Startup
script set and configure the corresponding startup script. -
After enabling, you can see the corresponding automatic trigger configuration in 「Manage / Automatic Trigger Configuration」. Click 【Execute】 to execute it immediately without waiting for the scheduled time. After a while, you can check the execution task records and corresponding logs. `, click the 【Install】 button, the installation interface will pop up for installation.
Verification¶
- In 「Manage/Automatic Trigger Configuration」, confirm whether the corresponding task has the corresponding automatic trigger configuration, and you can also check the corresponding task records and logs to check for any abnormalities
- In TrueWatch, 「Infrastructure / Custom」, check whether the asset information exists
- In TrueWatch, 「Metrics」, check whether there is corresponding monitoring data
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 |
---|---|---|---|---|
cluster_active_sessions |
Active Connections | userId,clusterId,nodeId | Average | count |
cluster_blktag_utilization |
blktag Utilization | userId,clusterId | Average | % |
cluster_connection_utilization |
Connection Utilization | userId,clusterId,nodeId | Average,Maximum,Minimum | % |
cluster_cpu_utilization |
CPU Utilization | userId,clusterId,nodeId | Average | % |
cluster_data_io |
Storage Engine IO Throughput per Second | userId,clusterId,nodeId | Average | KB |
cluster_data_iops |
Storage Engine IO Count per Second | userId,clusterId,nodeId | Average | countSecond |
cluster_direntry_utilization |
direntry Utilization | userId,clusterId | Average | % |
cluster_disk_utilization |
Disk Utilization | userId,clusterId | Average | % |
cluster_imci_datasize |
IMCI Node Columnar Index Storage | userId,clusterId,nodeId | Average | MB |
cluster_imci_exememusage |
IMCI Executor Memory Usage | userId,clusterId,nodeId | Average | Byte |
cluster_imci_stmtsexepersec |
IMCI SQL Queries per Second | userId,clusterId,nodeId | Average | count/s |
cluster_imci_stmtsinqueue |
IMCI SQL Count in Queue | userId,clusterId,nodeId | Average | count |
cluster_imci_tmpfileusedsize |
IMCI Executor Temporary Table Size | userId,clusterId,nodeId | Average | Byte |
cluster_inode_utilization |
inode Utilization | userId,clusterId | Average | % |
cluster_input_traffic |
Network Input Traffic per Second | userId,clusterId,nodeId | Average,Maximum,Minimum | KByte/s |
cluster_iops |
IO Count per Second | userId,clusterId,nodeId | Average | countSecond |
cluster_iops_usage |
IOPS Utilization | userId,clusterId,nodeId | Average,Maximum,Minimum | % |
cluster_mem_hit_ratio |
Memory Hit Rate | userId,clusterId,nodeId | Average | % |
cluster_memory_utilization |
Memory Utilization | userId,clusterId,nodeId | Average | % |
cluster_mps |
Data Operations per Second | userId,clusterId,instanceId | Average,Maximum,Minimum | countSecond |
cluster_output_traffic |
Network Output Traffic per Second | userId,clusterId,nodeId | Average,Maximum,Minimum | KByte/s |
cluster_proxy_cpu_utilization |
Proxy CPU Utilization | userId,clusterId | Average,Maximum,Minimum | % |
cluster_qps |
Queries per Second | userId,clusterId,nodeId | Average | count |
cluster_redo_write_rate |
redo Log Write Rate | userId,clusterId,nodeId | Average | Byte/s |
cluster_replica_lag |
Read-only Node Replication Latency | userId,clusterId,instanceId | Average,Minimum,Maximum | seconds |
cluster_slow_queries_ps |
Slow Queries per Second | userId,clusterId,nodeId | Average | countS |
cluster_total_session |
Total Current Connections | userId,clusterId,nodeId | Average,Maximum,Minimum | count |
cluster_tps |
Transactions per Second | userId,clusterId,nodeId | Average | countS |
Objects¶
The collected Alibaba Cloud PolarDB MySQL object data structure can be seen in 「Infrastructure - Custom」
{
"measurement": "aliyun_polardb",
"tags": {
"name" : "pc-xxxx",
"RegionId" : "cn-hangzhou",
"VpcId" : "vpc-xxxx",
"DBNodeNumber" : "2",
"PayType" : "Postpaid",
"DBType" : "MySQL",
"LockMode" : "Unlock",
"DBVersion" : "8.0",
"DBClusterId" : "pc-xxxx",
"DBClusterNetworkType": "VPC",
"ZoneId" : "cn-hangzhou-i",
"Engine" : "POLARDB",
"Category" : "Normal",
"DBClusterDescription": "pc-xxxx",
"DBNodeClass" : "polar.mysql.x4.medium"
},
"fields": {
"DBNodes" : "{Node List JSON Data}",
"Database" : "[Database Details JSON Data]",
"ExpireTime": "",
"CreateTime": "2022-06-17T06:07:19Z",
"message" : "{Instance JSON Data}"
}
}
Logs¶
Slow Query Statistics¶
Prerequisites¶
Note: The code execution of this script depends on the PolarDB instance object collection. If the custom object collection of PolarDB is not configured, the slow log script cannot collect slow log data
Install Script¶
On the previous basis, you need to install another script corresponding to PolarDB Slow Query Statistics Log Collection
In 「Manage / Script Market」, click and install the corresponding script package:
- 「TrueWatch Integration (Alibaba Cloud - PolarDB Slow Query Statistics Log Collection)」(ID:
integration_alibabacloud_polardb_slowlog
)
After the data is synchronized normally, you can view the data in TrueWatch「Logs」.
The reported data example is as follows:
{
"measurement": "aliyun_polardb_slowlog",
"tags": {
"DBName" : "PolarDB_MySQL",
"DBNodeId": "pi-***************"
},
"fields": {
"CreateTime" : "2023-05-22Z",
"MaxExecutionTime" : 60,
"MaxLockTime" : 1,
"ParseMaxRowCount" : 1,
"ParseTotalRowCounts" : 2,
"ReturnMaxRowCount" : 3,
"ReturnTotalRowCounts": 1,
"SQLHASH" : "U2FsdGVkxxxx",
"SQLText" : "select id,name from tb_table",
"TotalExecutionCounts": 2,
"TotalExecutionTimes" : 2,
"TotalLockTimes" : 1,
"message" : "{Log JSON Data}"
}
}
Some parameter descriptions are as follows:
Field | Type | Description |
---|---|---|
MaxExecutionTime |
Long | Execution Duration (Max), Unit: Seconds |
TotalExecutionTimes |
Long | Execution Duration (Total), Unit: Seconds |
TotalLockTimes |
Long | Lock Duration (Total), Unit: Seconds |
MaxLockTime |
Long | Lock Duration (Max), Unit: Seconds |
ReturnMaxRowCount |
Long | Returned SQL Rows (Max) |
ReturnTotalRowCounts |
Long | Returned SQL Rows (Total) |
ParseMaxRowCount |
Long | Parsed SQL Rows (Max) |
ParseTotalRowCounts |
Long | Parsed SQL Rows (Total) |
TotalExecutionCounts |
Long | Execution Count (Total) |
Note: The fields in
tags
,fields
may change with subsequent updatesNote:
fields.message
is a JSON serialized string
Slow Query Details¶
Prerequisites¶
Note: The code execution of this script depends on the PolarDB instance object collection. If the custom object collection of PolarDB is not configured, the slow log script cannot collect slow log data
Install Script¶
On the previous basis, you need to install another script corresponding to PolarDB Slow Query Details Log Collection
In 「Manage / Script Market」, click and install the corresponding script package:
- 「TrueWatch Integration (Alibaba Cloud - PolarDB Slow Query Details Log Collection)」(ID:
integration_alibabacloud_polardb_slowlog_record
)
After the data is synchronized normally, you can view the data in TrueWatch「Logs」.
The reported data example is as follows:
{
"measurement": "aliyun_polardb_slowlog_record",
"tags": {
"DBName" : "PolarDB_MySQL",
"DBNodeId" : "pi-***************",
"HostAddress": "testdb[testdb] @ [100.**.**.242]"
},
"fields": {
"SQLText" : "select id,name from tb_table",
"ExecutionStartTime": "2021-04-07T03:47Z",
"QueryTimes" : 20,
"ReturnRowCounts" : 0,
"ParseRowCounts" : 0,
"LockTimes" : 0,
"QueryTimeMS" : 100,
"message" : "{Log JSON Data}"
}
}
Some parameter descriptions are as follows:
Field | Type | Description |
---|---|---|
QueryTimes |
Long | SQL Execution Duration, Unit: Seconds |
QueryTimesMS |
Long | Query Time. Unit: Milliseconds |
ReturnRowCounts |
Long | Returned Rows |
ParseRowCounts |
Long | Parsed Rows |
ExecutionStartTime |
String | SQL Execution Start Time. Format: YYYY-MM-DDThh:mmZ (UTC Time) |
LockTimes |
Long | SQL Lock Duration, Unit: Seconds |
Note: The fields in
tags
,fields
may change with subsequent updatesNote:
fields.message
is a JSON serialized string