Skip to content

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 Guance integration - extension - hosted Func

If you deploy Func yourself, refer to Self-deployed Func

Enable Script

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

Hosted Edition Enable Script

  1. Log in to Guance console
  2. Click on the [Integration] menu and select [Cloud Account Management]
  3. Click [Add Cloud Account], select [Alibaba Cloud], and fill in the required information on the interface. If cloud account information has been configured before, skip this step.
  4. Click [Test], after a successful test click [Save]. If the test fails, check whether the related configuration information is correct and retest.
  5. Click on the [Cloud Account Management] list to see the added cloud accounts, click on the corresponding cloud account, and enter the details page.
  6. Click the [Integration] button on the cloud account details page. In the Not Installed list, find Alibaba Cloud RDS SQLServer, click the [Install] button, and install it through the pop-up installation interface.

Manual Enable Script

  1. Log in to the Func console, click [Script Market], go to the official script market, and search for: guance_aliyun_rds

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

  4. After enabling, you can see the corresponding automatic trigger configuration in "Management / Automatic Trigger Configuration". Click [Execute] to immediately execute once without waiting for the scheduled time. Wait a moment, and you can view the execution task records and corresponding logs. We default collect some configurations, for more details see the Metrics section.

Configure Custom Cloud Object Metrics

Verification

  1. In "Management / Automatic Trigger Configuration", confirm whether the corresponding tasks have corresponding automatic trigger configurations, and at the same time, check the corresponding task records and logs for any abnormalities.
  2. In Guance, under "Infrastructure / Custom", check if there is asset information.
  3. In Guance, under "Metrics", check if there are corresponding monitoring data.

Metrics

After configuring Alibaba Cloud - Cloud Monitoring, the default metric set is as follows. You can collect more metrics through configuration Alibaba Cloud Cloud Monitoring Metric Details

Metric Id Metric Name Dimensions Statistics Unit
SQLServer_CpuUsage SQLServerCpu Usage Rate userId,instanceId Average,Maximum,Minimum %
SQLServer_DiskUsage SQLServer Disk Usage Rate userId,instanceId Average,Maximum,Minimum %
SQLServer_IOPS SQLServer IO Operations Per Second 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

Objects

The collected Alibaba Cloud RDS object data structure can be seen from "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}",
  }
}

Logs

Slow Query Statistics

Prerequisites for Slow Query Statistics

Note 1: The code execution of this script depends on the collection of RDS instance objects. 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 returning statistics data from Alibaba Cloud, there may be delays in the collector updating data. For detailed reference, see Alibaba Cloud documentation: Cloud Database RDS Slow Log Statistics Query. Note 3: This collector supports all versions of MySQL (except the basic version of MySQL 5.7), SQL Server 2008 R2, MariaDB 10.3 types of databases. To collect other types of databases, please use the Alibaba Cloud-RDS Slow Query Details collector.

Slow Query Statistics Installation Script

Based on the previous steps, you need to install another script corresponding to RDS Slow Query Statistics Log Collection

In "Management / Script Market", click and install the corresponding script package:

  • "Guance Integration (Alibaba Cloud - RDS Slow Query Statistics Log Collection)" (ID: guance_aliyun_rds_slowlog)

After the data synchronizes normally, you can view the data in the "Logs" section of Guance.

An example of the reported data 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}"
  }
}

Descriptions of some parameters are as follows:

Field Type Description
SQLServerTotalExecutionTimes int SQL Server Execution Duration (Total Value, milliseconds)
AvgExecutionTime int Execution Time (Average Value) Unit: seconds
SQLServerAvgExecutionTime int Execution Time (Average Value) Unit: seconds
MySQLTotalExecutionTimes int MySQL Execution Time (Total Value) Unit: seconds
SQLServerTotalExecutionTimes int SQL Server Execution Time (Total Value) Unit: milliseconds
SQLServerTotalExecutionCounts int SQL Server Execution Count (Total Value)
MySQLTotalExecutionCounts int MySQL Execution Count (Total Value)

Note: Fields such as AvgExecutionTime, SQLServerAvgExecutionTime, SQLServerTotalExecutionTimes, etc., are only supported by SQL Server instances. Note: Fields in tags and fields may change with subsequent updates.

Slow Query Details

Prerequisites for Slow Query Details

Note: The code execution of this script depends on the collection of RDS instance objects. If the custom object collection of RDS is not configured, the slow log script cannot collect slow log data.

Slow Query Details Installation Script

Based on the previous steps, you need to install another script corresponding to RDS Slow Query Details Log Collection

In "Management / Script Market", click and install the corresponding script package:

  • "Guance Integration (Alibaba Cloud - RDS Slow Query Details Log Collection)" (ID: guance_aliyun_rds_slowlog_record)

After the data synchronizes normally, you can view the data in the "Logs" section of Guance.

Configuration Cloud Database RDS Slow Query Details

An example of the reported data 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}"
  }
}

Descriptions of some parameters are as follows:

Field Type Description
QueryTimes int Execution Duration. Unit: seconds (s)
QueryTimesMS int Execution Duration. Unit: milliseconds (ms)
ReturnRowCounts int Returned Row Count
ParseRowCounts int Parsed Row Count
ExecutionStartTime str Execution Start Time
CpuTime int CPU Processing Time
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 in tags and fields may change with subsequent updates. *Tip: fields.message is a JSON serialized string

Feedback

Is this page helpful? ×