Monitoring Microsoft SQL Server
Instana automatically deploys and installs the Microsoft SQL Server sensor after you install the Instana agent.
Support information
To make sure that the Microsoft SQL Server sensor is compatible with your current setup, check the following support information sections:
Supported operating systems
The sensor supports the following operating systems:
- Windows
- Linux
Supported versions and support policy
The sensor supports the following versions of Microsoft SQL Server:
- SQL Server 2016
- SQL Server 2017
- SQL Server 2019
- SQL Server 2022
The sensor also supports monitoring Microsoft SQL Server Always On Availability Groups (AG) for high availability and disaster recovery configurations.
The following table shows the latest supported version and support policy:
| Technology | Support policy | Latest technology version | Latest supported version |
|---|---|---|---|
| Microsoft SQL Server | 45 days | 2025 | 2025 |
For more information about the support policy, see Support strategy for sensors.
Supported client-side tracing
For this technology, Instana supports client-side tracing for the following languages and runtimes:
Configuring the Microsoft SQL Server sensor
Instana supports both local and remote monitoring for Microsoft SQL Server sensor.
Local
You must install the Instana host agent on the same system in which Microsoft SQL Server is installed. To install the Instana host agent on Windows, see the Installing the host agent on Windows topic. To install the Instana host agent on Linux, see the Installing the host agent on Linux topic.
After you install the Instana agent, it enables the Microsoft SQL Server sensor by default. You can choose how the Instana agent connects to the SQL Server as follows:
-
SQL Server authentication: If you provide the instance, username, password, and port (clear-text) in the agent configuration file
*instanaAgentDir*/etc/instana/configuration.yamlas shown in the following configuration, the agent connects to the SQL Server by using the SQL Server authentication:Note:The local monitoring sensor design is updated to support multiple database instances that use the SQL Server authentication. As a result, all the local monitoring configurations must now be defined under thelocaltag. However, the design remains compatible with the existing configuration for monitoring single database instance, which continues to be supported.com.instana.plugin.mssql: local: # multiple configurations supported - instance: 'MSSQLSERVER' # instance name of MsSQL Server user: 'mssql' password: 'password' port: '1433' poll_rate: 60 # seconds. top_queries_poll_rate: 120 # seconds. -
Windows Authentication: If you leave the configuration section in the agent configuration file commented out or leave the username and password empty, the agent tries to connect using Windows Authentication. When Windows Authentication is used, the agent authenticates with the credentials.
-
poll_rate: Specify the poll rate. By default, the value is 1 second. -
top_queries_poll_rate: Specify the poll rate for most used queries. By default, the value is 60 seconds.When the Windows Authentication is used, ensure that your account has appropriate permissions as described in the Required server or database permissions section.
Remote
For remote monitoring, use the following configuration:
com.instana.plugin.mssql:
remote: # multiple configurations supported
- host: 'host-1'
instance: 'MSSQLSERVER02' #Instance name of MSSQL Server
user: 'mssql'
password: 'password'
port: '1434'
availabilityZone: 'MSSQLSERVER02_REMOTE'
poll_rate: 60 # seconds
top_queries_poll_rate: 120 # seconds
Instana shows the configured remote Microsoft SQL instance as a separate box in the specified availabilityZone on the Infrastructure dashboard in the Instana UI.
Setting up SSL or TLS support
For the Instana agent to securely connect to your MS SQL Server, configure the agent configuration files<agent_install_dir>/etc/instana/configuration.yaml as follows:
Local
For local monitoring, use the following configuration:
com.instana.plugin.mssql:
local:
...
sslTrustStoreLocation: '/path/to/truststore.jks'
sslTrustStorePassword: 'trustStorePassword'
certificateHostname: '<hostname>' # hostname given in SAN or CN of SSL/TLS certificate.
Remote
For remote monitoring, use the following configuration:
com.instana.plugin.mssql:
remote:
...
sslTrustStoreLocation: '/path/to/truststore.jks'
sslTrustStorePassword: 'trustStorePassword'
certificateHostname: '<hostname>' # hostname given in SAN or CN of SSL/TLS certificate.
Network settings
If you are running the Microsoft SQL database and the Instana agent on a Windows system, ensure that the TCP/IP protocol is enabled and the SQL Server Browser service is running.
Setting a custom port
If you want to specify a custom port that the sensor must use to monitor the instance (other than the default port 1433), specify the port field in the agent configuration file:
com.instana.plugin.mssql:
port: 2529 # custom Microsoft SQL TCP port
Required server or database permissions
Instana queries dynamic management views (DMV) on SQL Server by using the user credentials specified in the agent configuration file. Ensure that the SQL user specified in the agent configuration file has the VIEW SERVER STATE and VIEW DATABASE STATE permissions. For more information on these permissions, see System dynamic management views.
To collect disk volume and auto-growth metrics, the monitoring login must also be a member of the
sysadmin fixed server role. This requirement exists because
sys.master_files, which is used to enumerate database files for these metrics, does
not return any rows to non-sysadmin logins. This membership requirement applies to
both Windows Authentication and SQL Server Authentication.
If disk volume and auto-growth metrics are not required, sysadmin membership is
not needed.
Metrics collection
To view the metrics, select Infrastructure from the navigation menu of the Instana UI, click a specific monitored host, and then you can see a host dashboard with all the collected metrics and monitored processes.
Instance-level metrics
The following metrics are collected at the SQL Server instance level:
Configuration data
- Instance Name
- Version
- Process ID
- Start Time
Performance metrics
| Metric | Description | Granularity |
|---|---|---|
| User Connections | The number of user connections | 1 second |
| Maximum Connection | The maximum number of concurrent user connections. By default, the value is 0, which means that an unlimited number of users can connect. To change this value, see Configure the user connections Server Configuration Option. | 1 second |
| Wait-Times on server | Page IO-Latch EX, Page IO-Latch SH, Async Network IO, CX-Packet, Writelog | 1 second |
| Reads and Writes | Virtual file reads and writes in bytes | 1 second |
| Transactions | The number of write transactions | 1 second |
| Errors | User, DB Offline and Kill Connection errors | 1 second |
| Locks | The number of Lock requests and Deadlocks | 1 second |
| Db Memory | Db memory used and capacity in megabytes | 1 second |
| Virtual Memory | Virtual memory in MB | 1 second |
| Response Time | Response Time of Transaction | 1 second |
| DB Cache Hit Rate | DB Cache Hit Rate in % | 1 second |
Storage metrics
The following disk volume metrics are collected at the instance level:
| Metric | Description | Granularity |
|---|---|---|
| Total Database Files Size | Total size of all database files in megabytes | 1 second |
| Total Disk Size | Total capacity of the disk volume in megabytes | 1 second |
| Available Disk Space | Free space available on disk in megabytes | 1 second |
| File Disk Usage Percentage | Percentage of disk capacity used by database files | 1 second |
DB file autogrow metrics
The following metrics provide visibility into the growth capacity and usage of individual database files:
| Metric | Description | Granularity |
|---|---|---|
| Database File Current Size | Current size of the database file in megabytes | 1 second |
| Autogrow Used Percentage | Percentage of the maximum file size that is currently used | 1 second |
Database
| Metric | Description | Granularity |
|---|---|---|
| User Connections | The number of user connections | 1 second |
| Reads and Writes | Virtual file reads and writes in bytes | 1 second |
| Transactions | The number of write transactions | 1 second |
Top Queries
You can find the section "Top Queries" on the dashboard of your SQL Server. This table lists the top 50 queries (based on the time that is consumed by these queries), being issued against the monitored instance. In addition to the processed SQL Statement, you can see the following metrics:
| Metric | Description | Granularity |
|---|---|---|
| Execution Time | Total and Last Execution Time | 60 seconds |
| Logical Reads | Last Logical Reads | 60 seconds |
| Logical Writes | Last Logical Writes | 60 seconds |
AG entity-level metrics
For Microsoft SQL Server Always On Availability Groups (AG), the sensor creates a separate AG entity that collects aggregate metrics and configuration data for the availability group and its replicas.
Configuration data
| Metric | Description |
|---|---|
| Availability Group Name | Name of the Always On Availability Group |
| WSFC Cluster Name | Name of the Windows Server Failover Clustering (WSFC) cluster |
| Number of Listeners | Total number of listeners configured for the Availability Group |
Performance metrics
| Metric | Description | Granularity |
|---|---|---|
| Replica Connected State | Connection state of the replica: Disconnected or Connected | 1 second |
| Availability Mode | Availability mode of the replica: Asynchronous commit, Synchronous commit, or Configuration only | 1 second |
| Synchronization Health | Synchronization health of the replica: Not healthy, Partially healthy, or Healthy | 1 second |
| Failover Mode | Failover mode of the replica: Automatic failover or Manual failover | 1 second |
| Role | Role of the replica: Resolving, Primary, or Secondary | 1 second |
| Database State | State of the database in the availability group: Online, Restoring, Recovering, Recovery pending, Suspect, Emergency, or Offline | 1 second |
| Synchronization State | Synchronization state of the database in the availability group | 1 second |
| Log Send Queue Size | Amount of log records not yet sent to the secondary replica, in kilobytes | 1 second |
| Redo Queue Size | Amount of log records on the secondary replica not yet redone, in kilobytes | 1 second |
| Log Send Rate | Rate at which log records are being sent to the secondary replica | 1 second |
| Redo Rate | Rate at which log records are being redone on the secondary replica | 1 second |
| Lag (Seconds) | Replication lag between the primary and secondary replica in seconds | 1 second |
Troubleshooting encrypted connections (SSL or TLS)
If the Instana agent fails to connect to your encrypted MSSQL server, import your trusted certificate into your JRE's cacerts (jvm/jre/lib/security/cacerts) file by using the following keytool command:
keytool -import -alias ALIAS_NAME -keystore "/path/to/jre/cacerts" -file YOUR_CERTIFICATE_NAME.crt