Aliyun RDS SQLServer¶
Use the「Guance Synchronization」series script package in the script market to synchronize data from cloud monitoring cloud assets to the Guance.
config¶
Install Func¶
Recommend opening 「Integrations - Extension - DataFlux Func (Automata)」: All preconditions are installed automatically, Please continue with the script installation
If you deploy Func yourself,Refer to Self-Deployment of Func
Recommended deployment of GSE version
Installation script¶
Tip:Please prepare Aliyun AK that meets the requirements in advance(For simplicity's sake,,You can directly grant the global read-only permission
ReadOnlyAccess
)
To synchronize the monitoring data of RDS cloud resources, we install the corresponding collection script:「Guance Integration(Aliyun - RDS Collect)」(ID:guance_aliyun_rds
)
Click "Install" and enter the corresponding parameters: Aliyun AK, Aliyun account name.。
tap "Deploy startup Script",The system automatically creates Startup
script sets,And automatically configure the corresponding startup script。
After this function is enabled, you can view the automatic triggering configuration in「Management / Crontab Config」。Click "Run",you can immediately execute once, without waiting for a regular time。After a while, you can view task execution records and corresponding logs。
If you want to collect logs, you must enable the corresponding log collection script. If you want to collect bills, start the cloud bill collection script.
We collected some configurations by default, as described in the Metrics column Configure custom cloud object metrics
Verify¶
- In「Management / Crontab Config」check whether the automatic triggering configuration exists for the corresponding task,In addition, you can view task records and logs to check whether exceptions exist
- On the Guance platform, click 「Infrastructure / Custom」 to check whether asset information exists
- On the Guance platform, press 「Metrics」 to check whether monitoring data exists
Metric¶
Configure Ali Cloud - cloud monitoring. The default metric set is as follows. You can collect more metrics by configuring them Aliyun Monitor Metrics Details
Metric Id | Metric Name | Dimensions | Statistics | Unit |
---|---|---|---|---|
SQLServer_CpuUsage |
SQLServerCpu usage | userId,instanceId | Average,Maximum,Minimum | % |
SQLServer_DiskUsage |
SQLServer disk usage | userId,instanceId | Average,Maximum,Minimum | % |
SQLServer_IOPS |
SQL Server IO count per second | userId,instanceId | Average,Maximum,Minimum | countSecond |
SQLServer_NetworkRead |
SQLServer outbound network bandwidth | userId,instanceId | Average,Maximum,Minimum | bits/s |
SQLServer_NetworkWrite |
SQLServer inbound network 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 number of connections | userId,instanceId | Average,Maximum,Minimum | count |
Object¶
The collected Aliyun RDS object data structure can see the object data from 「Infrastructure-custom-defined」」
{
"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" : "{Details of the data library JSON data}",
"SSLExpireTime" : "2022-10-11T08:16:43Z",
"message" : "{Instance JSON data}",
}
}
Log¶
Slow query statistics¶
The prerequisite for slow query statistics¶
Tip 1:The execution of this script depends on RDS instance object collection. If RDS custom object collection is not configured, the slow log script will not be able to collect slow log data.
Tip 2:Due to the 6 to 8 hours data delay in the statistics returned by Aliyun, there might be a delay in the collector's data updates. For more details, please refer to the Aliyun documentation on "Cloud Database RDS Query Slow Log Statistics."
Tip 3:This collector supports all versions of MySQL (except for MySQL 5.7 Basic Edition), SQL Server 2008 R2, and MariaDB 10.3 databases. If you want to collect data from other types of databases, please use the Aliyun-RDS Slow query details collector.
Slow Query Statistics Installation Script¶
On top of that, you need to install a corresponding collector. The script for RDS slow query log collection
Click and install the corresponding script package in「Management / Script market」:
- 「Guance Integration(Aliyun - RDS Slow query statistical log Collect)」(ID:
guance_aliyun_rds_slowlog
)
Once the data is successfully synchronized, you can view it in the "Logs" section of Observing Cloud.
Examples of reported data are 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}",
"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}"
}
}
The partial parameter explanations are as follows:
Fields | Type | Description |
---|---|---|
SQLServerTotalExecutionTimes |
int | SQL Server Execution Duration (Total, in 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) |
Attention:The fields
AvgExecutionTime
,SQLServerAvgExecutionTime
,SQLServerTotalExecutionTimes
, etc. are only supported by SQL Server instances.Attention:The fields in
tags
andfields
may be subject to changes in subsequent updates.
Slow query details¶
Prerequisite for slow query of details¶
Tip:This script's code execution relies on RDS instance object collection. If RDS custom object collection is not configured, the slow log script will not be able to collect slow log data.
Slow query details installation script¶
On top of that, you need to install a corresponding script for The script for RDS slow query log collection.
Click and install the corresponding script package in「Management / Script market」:
- 「Guance Integration(Aliyun -RDS Slow query detail log Collect)」(ID:
guance_aliyun_rds_slowlog_record
)
After the data is successfully synchronized, you can view it in the 「Logs」 section of Observing Cloud.
settingsCloud Database RDS slow query details
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}",
"QueryTimes" : 0,
"QueryTimesMS" : 0,
"ReturnRowCounts" : 0,
"ParseRowCounts" : 0,
"ExecutionStartTime" : "2022-02-02T12:00:00Z",
"CpuTime" : 1,
"RowsAffectedCount" : 0,
"LastRowsAffectedCount" : 0,
"message" : "{Log JSON data}"
}
}
The partial parameter explanations are as follows:
Fields | Type | Description |
---|---|---|
QueryTimes |
int | Execution Duration. Unit: Seconds (s) |
QueryTimesMS |
int | Execution Duration. Unit: Milliseconds (ms) |
ReturnRowCounts |
int | Number of Rows Returned |
ParseRowCounts |
int | Number of Rows Parsed |
ExecutionStartTime |
str | Execution Start Time |
CpuTime |
int | CPU Processing Duration |
RowsAffectedCount |
int | Number of Rows Affected |
LastRowsAffectedCount |
int | Number of Rows Affected by the Last Statement |
Attention:The fields
CpuTime
,RowsAffectedCount
,LastRowsAffectedCount
, etc. are only supported by SQL Server instances.Attention:The fields in
tags
andfields
may be subject to changes in subsequent updates.*Attention:The
fields.message
is a JSON-serialized string.