Tencent Cloud MySQL¶
Use the script packages in the "Guance Cloud Sync" series in the Script Market to synchronize cloud monitoring and cloud asset data to Guance
Configuration¶
Install Func¶
It is recommended to activate the Guance Integration - Extensions - DataFlux Func (Automata): all prerequisites are automatically installed, please proceed with the script installation.
If you are deploying Func yourself, refer to Self-deploying Func
If deploying Func manually, refer to Self-deploy Func
Activate Script¶
Note: Please prepare a Tencent Cloud AK that meets the requirements in advance (for simplicity, you can directly grant global read-only permission
ReadOnlyAccess)
Activate Script in DataFlux Func (Automata)¶
- Log in to the Guance console.
- Click the 【Integration】 menu, and select 【Cloud Account Management】.
- Click 【Add Cloud Account】, select 【Tencent Cloud】, and fill in the required information on the interface. If the cloud account information has been configured before, skip this step.
- Click 【Test】, and click 【Save】 after the test is successful. If the test fails, please check if the relevant configuration information is correct 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
Tencent Cloud CDBin theNot Installedlist, and click the 【Install】 button. The installation interface will pop up for installation.
Activate Script Manually¶
-
Log in to the Func console, click 【Script Market】, enter the Guance Script Market, and search for
integration_tencentcloud_mysql. -
Click 【Install】, and enter the corresponding parameters: Tencent Cloud AK, SK, and account name.
-
Click 【Deploy Startup Script】, the system will automatically create a
Startupscript set and automatically configure the corresponding startup script. -
After activation, 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¶
- 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.
- In Guance, check if asset information exists in 【Infrastructure / Custom】.
- In Guance, check if there is corresponding monitoring data in 【Metrics】.
Metrics¶
After configuring Tencent Cloud Cloud Monitoring, the default Measurement is as follows. More Metrics can be collected through configuration Tencent Cloud Cloud Monitoring Metrics Details
Resource Monitoring¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
BytesReceived |
Internal Inbound Traffic | Bytes received per second | Bytes/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
BytesSent |
Internal Outbound Traffic | Bytes sent per second | Bytes/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
Capacity |
Disk Occupied Space | Including MySQL data directory and binlog、relaylog、undolog、errorlog、slowlog log space |
MB | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
CpuUseRate |
CPU Utilization | Allows idle time overuse, CPU utilization may exceed 100% | % | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
IOPS |
IOPS | Input/output operations per second (or read/write count) | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
MemoryUse |
Memory Occupied | Allows idle time overuse, actual memory usage may exceed purchased specifications | MB | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
MemoryUseRate |
Memory Utilization | Allows idle time overuse, memory utilization may exceed 100% | % | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
RealCapacity |
Data Used Space | Only including MySQL data directory, excluding binlog、relaylog、undolog、errorlog、slowlog log space |
MB | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
VolumeRate |
Disk Utilization | Disk used space/instance purchased space | % | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、3600s、86400s |
Engine Monitoring (General)- MyISAM¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
KeyCacheHitRate |
myisam Cache Hit Rate | myisam engine cache hit rate | % | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
KeyCacheUseRate |
myisam Cache Usage Rate | myisam engine cache usage rate | % | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (General)- InnoDB¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
InnodbCacheHitRate |
innodb Cache Hit Rate | Innodb engine cache hit rate | % | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
InnodbCacheUseRate |
innodb Cache Usage Rate | Innodb engine cache usage rate | % | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbNumOpenFiles |
Current InnoDB Open Table Count | Innodb engine current open table count | Count | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbOsFileReads |
innodb Disk Read Count | Innodb engine disk file read count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbOsFileWrites |
innodb Disk Write Count | Innodb engine disk file write count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbOsFsyncs |
innodbfsyn Count | Innodb engine fsync function call count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
Engine Monitoring (General)- Connection¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
ConnectionUseRate |
Connection Usage Rate | Current open connections/maximum connections | % | InstanceId、InstanceType(Optional) | 5s、10s、60s、300s、3600s |
MaxConnections |
Maximum Connections | Maximum connections | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Qps |
Operations Per Second | SQL operations executed per second (including insert、select、update、delete、replace), QPS mainly reflects the actual processing capacity of TencentDB instances | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
ThreadsConnected |
Current Connections | Current open connections count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Tps |
Transactions Per Second | Transaction processing count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (General)- Access¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
ComDelete |
Delete Count | Delete count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
ComInsert |
Insert Count | Insert count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
ComReplace |
Replace Count | Replace count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、6400s |
ComUpdate |
Update Count | Update count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Queries |
Total Access Volume | All executed SQL statements, including set, show, etc. | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
QueryRate |
Access Volume Proportion | Operations per second QPS/recommended operations per second | % | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
SelectCount |
Query Count | Query count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
SelectScan |
Full Table Scan Count | Full table search query count | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
SlowQueries |
Slow Query Count | Query count exceeding long_query_time seconds | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (General)- Table¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
CreatedTmpTables |
Memory Temporary Table Count | Temporary table creation count | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
TableLocksWaited |
Table Lock Wait Count | Table lock wait count | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
OpenedTables |
Opened Table Count | Engine opened table count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
TableLocksImmediate |
Immediate Table Lock Release Count | Engine immediate table lock release count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (Extended)- Tmp¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
CreatedTmpDiskTables |
Disk Temporary Table Count | Disk temporary table creation count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
CreatedTmpFiles |
Temporary File Count | Temporary file creation count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (Extended)- Key¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
KeyBlocksUnused |
Unused Key Cache Block Count | myisam engine unused key cache block count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
KeyBlocksUsed |
Used Key Cache Block Count | myisam engine used key cache block count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
KeyReadRequests |
Key Cache Read Block Count | myisam engine key cache block read count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
KeyReads |
Disk Read Block Count | myisam engine disk block read count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
KeyWriteRequests |
Key Cache Write Block Count | myisam engine key cache block write count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
KeyWrites |
Disk Write Block Count | myisam engine disk block write count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (Extended)- InnoDB Row¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
InnodbRowLockTimeAvg |
InnoDB Average Row Lock Time (ms) | Innodb engine row lock average duration | ms | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbRowLockWaits |
InnoDB Row Lock Wait Count | Innodb engine row lock wait count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbRowsDeleted |
InnoDB Row Delete Count | Innodb engine row delete count per second | Rows/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbRowsInserted |
InnoDB Row Insert Count | Innodb engine row insert count per second | Rows/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbRowsRead |
InnoDB Row Read Count | Innodb engine row read count per second | Rows/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbRowsUpdated |
InnoDB Row Update Count | Innodb engine row update count per second | Rows/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、86400s |
Engine Monitoring (Extended)- InnoDB Data¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
InnodbDataRead |
InnoDB Read Volume | Innodb engine completed read data bytes per second | Bytes/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
InnodbDataReads |
InnoDB Total Read Volume | Innodb engine completed read data count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
InnodbDataWrites |
InnoDB Total Write Volume | Innodb engine completed write data count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
InnodbDataWritten |
InnoDB Write Volume | Innodb engine completed write data bytes per second | Bytes/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (Extended)- Handler¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
HandlerCommit |
Internal Commit Count | Transaction commit count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
HandlerReadRndNext |
Next Row Read Request Count | Next row read request count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
HandlerRollback |
Internal Rollback Count | Transaction rollback count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (Extended)- Buff¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
InnodbBufferPoolPagesFree |
InnoDB Free Page Count | Innodb engine memory free page count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s |
InnodbBufferPoolPagesTotal |
InnoDB Total Page Count | Innodb engine memory total page count | Count | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbBufferPoolReadRequests |
Innodb Buffer Pool Pre-read Page Count | Innodb engine completed logical read request count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
InnodbBufferPoolReads |
Innodb Disk Read Page Count | Innodb engine completed physical read request count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、 60s、 300s、 3600s、 86400s |
Engine Monitoring (Extended)- Others¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
LogCapacity |
Log Usage Volume | Engine log usage volume | MB | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s |
OpenFiles |
Open File Count | Engine open file count | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600、86400s |
Engine Monitoring (Extended)- Connection¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
ThreadsCreated |
Created Thread Count | Thread count created to handle connections | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
ThreadsRunning |
Running Thread Count | Active (non-sleeping) thread count | Count | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Engine Monitoring (Extended)- Access¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
ComCommit |
Commit Count | Commit count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
ComRollback |
Rollback Count | Rollback count per second | Times/second | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Database Proxy (Proxy)¶
| Metric Name | Metric Chinese Name | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|
ProxyCpuUseRate |
CPU Utilization | % | InstanceId、InstanceType | 5s、60s、300s、3600s、86400s |
ProxyCurrentConnections |
Current Connection Count | Count | InstanceId、InstanceType | 5s、 60s、 300s、 3600s、 86400s |
ProxyMemoryUseRate |
Memory Utilization | % | InstanceId、InstanceType | 5s、 60s、 300s、 3600s、 86400s |
ProxyQueries |
Request Count | Count | InstanceId、InstanceType | 5s、 60s、 300s、 3600s、 86400s |
ProxyRouteMaster |
Write Request Count | Count | InstanceId、InstanceType | 5s、 60s、 300s、 3600s、 86400s |
ProxyRouteSlave |
Read Request Count | Count | InstanceId、InstanceType | 5s、 60s、 300s、 3600s、 86400s |
ProxyMemoryUse |
Memory Occupied | MB | InstanceId、InstanceType | 5s、 60s、 300s、 3600s、 86400s |
Deployment Monitoring (Slave)¶
| Metric Name | Metric Chinese Name | Description | Unit | Dimensions | Statistical Granularity |
|---|---|---|---|---|---|
MasterSlaveSyncDistance |
Master-Slave Sync Distance | Master-slave binlog gap | MB | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
SecondsBehindMaster |
Master-Slave Sync Time | Master-slave sync time | Seconds | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
SlaveIoRunning |
IO Thread Status | IO thread running status | Status value (0-Yes,1-No,2-Connecting) | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
SlaveSqlRunning |
SQL Thread Status | SQL thread running status | Status value (0-Yes,1-No) | InstanceId、InstanceType(Optional) | 5s、60s、300s、3600s、86400s |
Objects¶
Collected Tencent Cloud MySQL object data structure, which can be seen in 【Infrastructure - Custom】.
{
"measurement": "tencentcloud_cdb",
"tags": {
"name" : "cdb-xxxxxxx",
"RegionId" : "ap-shanghai",
"Region" : "ap-shanghai",
"InstanceId" : "cdb-imxxxx",
"InstanceName" : "smart_check_test",
"InstanceType" : "1",
"Zone" : "ap-shanghai-3",
"ZoneName" : "",
"DeviceType" : "UNIVERSAL",
"EngineVersion": "8.0",
"Vip" : "172.xx.x.9",
"Status" : "1",
"ProtectMode" : "0",
"ProjectId" : "0",
"PayType" : "1",
"WanStatus" : "0"
},
"fields": {
"WanPort" : 0,
"Memory" : 1000,
"Volume" : 25,
"DeadlineTime": "0000-00-00 00:00:00",
"CreateTime" : "2022-04-27 15:18:06",
"message" : "{Instance JSON Data}"
}
}
Logs¶
Slow Query Statistics¶
Prerequisites¶
Note 1: Before using this collector, you must install the "Guance Integration Core Package" and its corresponding third-party dependencies.
Note 2: The code execution of this script depends on MySQL instance object collection. If MySQL custom object collection is not configured, the slow log script cannot collect slow log data.
Install Script¶
On the previous basis, you need to install a corresponding MySQL Slow Query Statistics Log Collection Script.
In 【Management / Script Market】, click and install the corresponding script package:
- ID:
integration_tencentcloud_mysql_slowlog
After the data is synchronized normally, you can view the data in Guance's 【Logs】.
The reported data example is as follows:
{
"measurement": "tencentcloud_cdb_slow_log",
"tags": {
"name" : "cdb-llxxxxx",
"Database" : "test",
"UserHost" : "9.xxx.xxx.122",
"UserName" : "root",
"InstanceId" : "cdb-lxxxxtk8",
"DeviceType" : "UNIVERSAL",
"EngineVersion" : "8.0",
"InstanceName" : "cdbxxxxx",
"InstanceType" : "1",
"PayType" : "1",
"ProjectId" : "0",
"ProtectMode" : "0",
"Region" : "ap-shanghai",
"RegionId" : "ap-shanghai",
"Status" : "1",
"Vip" : "172.xx.xxx.15",
"WanStatus" : "0",
"Zone" : "ap-shanghai-3",
"account_name" : "Script Development Tencent Account",
"cloud_provider": "tencentcloud"
},
"fields": {
"QueryTime" : 3.000195,
"SqlText" : "select sleep(3)",
"Timestamp" : 1652933796,
"LockTime" : 0,
"RowsExamined": 1,
"RowsSent" : 1,
"SqlTemplate" : "select sleep(?);",
"Md5" : "26A15F1AE530F28F",
"message" : "{Instance JSON Data}"
}
}
Partial parameter descriptions are as follows
| Field | Type | Description |
|---|---|---|
QueryTime |
float | SQL execution duration (seconds) |
Timestamp |
integer | SQL execution time |
Md5 |
str | SQL statement MD5 |
LockTime |
float | Lock duration (seconds) |
RowsExamined |
integer | Scanned rows |
RowsSent |
integer | Result set rows |
Note: The fields in
tagsandfieldsmay change with subsequent updatesNote 1:
tags.namevalue is the instance ID, used as a unique identifierNote 2:
fields.messageis a JSON serialized string