Alibaba Cloud RDS SQLServer¶
Alibaba Cloud RDS SQLServer 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 by yourself, refer to Deploy Func by Yourself
Enable 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
)
Enable Script for Automata¶
- Log in to the TrueWatch console
- Click the 【Integration】 menu, select 【Cloud Account Management】
- 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 before, ignore this step
- 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
- Click 【Cloud Account Management】, 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 RDS SQLServer
under theNot Installed
list, click the 【Install】 button, and 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, search:
integration_alibabacloud_rds
-
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 automatically 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.
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 exceptions
- In TrueWatch, check whether there is asset information in 「Infrastructure / Custom」
- In TrueWatch, check whether there is corresponding monitoring data in 「Metrics」
Metrics¶
After configuring Alibaba Cloud CloudMonitor, the default Measurement is as follows. You can collect more Metrics through configuration Alibaba Cloud CloudMonitor Metrics Details
Metric Id | Metric Name | Dimensions | Statistics | Unit |
---|---|---|---|---|
SQLServer_CpuUsage | SQLServer CPU Usage | userId,instanceId | Average,Maximum,Minimum | % |
SQLServer_DiskUsage | SQLServer Disk Usage | userId,instanceId | Average,Maximum,Minimum | % |
SQLServer_IOPS | SQLServer IOPS | userId,instanceId | Average,Maximum,Minimum | countSecond |
SQLServer_NetworkRead | SQLServer Network Outbound Bandwidth | userId,instanceId | Average,Maximum,Minimum | bits/s |
SQLServer_NetworkWrite | SQLServer Network Inbound Bandwidth | userId,instanceId | Average,Maximum,Minimum | bits/s |
SQLServer_QPS | SQLServer Queries Per Second | userId,instanceId | Average,Maximum,Minimum | countSecond |
SQLServer_TPS | SQLServer Transactions Per Second | userId,instanceId | Average,Maximum,Minimum | countSecond |
SQLServer_TotaConn | SQLServer Total Connections | userId,instanceId | Average,Maximum,Minimum | count |
Object¶
The collected Alibaba Cloud RDS 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}",
}
}
Logging¶
Slow Query Statistics¶
Prerequisites for Slow Query Statistics¶
Note 1: The code execution of this script depends on the RDS instance object collection. 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 hour delay in Alibaba Cloud statistical data return, the collector update data may be delayed. For details, refer to 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 type databases
Install Script for Slow Query Statistics¶
On the basis of the previous steps, you need to install a script corresponding to RDS Slow Query Statistics Log Collection
In 「Manage / 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 「Log」 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}"
}
}
Some 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 intags
,fields
may change with subsequent updates
Slow Query Details¶
Prerequisites for Slow Query Details¶
Note: The code execution of this script depends on the RDS instance object collection. 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 basis of the previous steps, you need to install a script corresponding to RDS Slow Query Details Log Collection
In 「Manage / 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 「Log」 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}"
}
}
Some parameter descriptions are as follows:
Field | Type | Description |
---|---|---|
QueryTimes |
int | Execution Duration. Unit: seconds (s) |
QueryTimesMS |
int | Execution Duration. Unit: milliseconds (ms) |
ReturnRowCounts |
int | Return Row Count |
ParseRowCounts |
int | Parse Row Count |
ExecutionStartTime |
str | Execution Start Time |
CpuTime |
int | CPU Processing Duration |
RowsAffectedCount |
int | Affected Row Count |
LastRowsAffectedCount |
int | Last Statement Affected Row Count |
Note: Fields such as
CpuTime
,RowsAffectedCount
,LastRowsAffectedCount
, etc. are only supported by SQL Server instances Note: Fields intags
,fields
may change with subsequent updates Note:fields.message
is a JSON serialized string