Skip to content

Alibaba Cloud PolarDB MySQL

Alibaba Cloud PolarDB MySQL Metrics display, including CPU utilization, memory hit rate, network traffic, connection count, QPS, TPS, read-only node latency, etc.

Configuration

Install Func

It is recommended to activate the TrueWatch Integration - Extensions - DataFlux Func (Automata)

For self-deployed Func, refer to Self-deployed Func

Activate Script

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

DataFlux Func (Automata) Activation Script

  1. Log in to the TrueWatch console.
  2. Click the [Integration] menu, select [Cloud Account Management].
  3. Click [Add Cloud Account], select [Alibaba Cloud], fill in the information required by the interface. If the cloud account information has been configured before, ignore this step.
  4. Click [Test]. After 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]. You can 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. Under the Not Installed list, find Alibaba Cloud PolarDB MYSQL, click the [Install] button, and install it in the pop-up installation interface.

Manual Activation Script

  1. Log in to the Func console, click [Script Market], enter the TrueWatch script market, search for: integration_alibabacloud_polardb.

  2. After clicking [Install], enter 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 automatically configure the corresponding startup script.

  4. After activation, you can see the corresponding automatic trigger configuration in "Management / Automatic Trigger Configuration". Click [Execute] to execute it immediately once without waiting for the scheduled time. Wait a moment, you can view the execution task records and corresponding logs. `, click the [Install] button, and install it in the pop-up installation interface.

Verification

  1. In "Management/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 see if there are any exceptions.
  2. In TrueWatch, check whether asset information exists in "Infrastructure / Custom".
  3. In TrueWatch, check whether there is corresponding monitoring data in "Metrics".

Metrics

After configuring Alibaba Cloud CloudMonitor, the default Measurement is as follows. More Metrics can be collected through configuration. Alibaba Cloud CloudMonitor Metric 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 operations 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 scheduling 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 operations 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 delay userId,clusterId,instanceId Average,Minimum,Maximum seconds
cluster_slow_queries_ps Slow queries per second userId,clusterId,nodeId Average countS
cluster_total_session Current total connections userId,clusterId,nodeId Average,Maximum,Minimum count
cluster_tps Transactions per second userId,clusterId,nodeId Average countS

Object

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}"
  }
}

Logging

Slow Query Details

Prerequisites

Note: The code operation of this script depends on the PolarDB instance object collection. If the custom object collection for 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 package for PolarDB Slow Query Details Log Collection.

In "Management / 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 the "Log" section of TrueWatch.

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}"
  }
}

Partial parameter descriptions are as follows:

Field Type Description
QueryTimes Long SQL execution duration, unit: seconds
QueryTimesMS Long Query time. Unit: milliseconds
ReturnRowCounts Long Returned row count
ParseRowCounts Long Parsed row count
ExecutionStartTime String SQL start execution time. Format: YYYY-MM-DDThh:mmZ (UTC time)
LockTimes Long SQL lock duration, unit: seconds

Note: The fields in tags and fields may change with subsequent updates.

Note: fields.message is a JSON serialized string.