SQL Server

The SQL Server Integration allows you to ingest and monitor the performance and health metrics of your Microsoft SQL Server databases. This integration is useful for tracking batch requests, query compilations, lock waits, page operations, transactions, and more.

Prerequisites

Middleware Host Agent (MW Agent) must be installed on your local machine. To install the MW Agent, see our Installation Guide.

Configuration

To set up the SQL Server Integration, you can configure the receiver using a Setting base approach. You may use this configuration approach to securely store your credentials and connection parameters.

Setting-Based Authentication

To set up the SQL Server integration, enter the required connection details directly in the provided form fields.

Required Fields

  • Host - The machine name or IP address where SQL Server is running.
  • Username - The username used to authenticate with SQL Server.
  • Password - The password for the provided username.
  • Server - The server IP (e.g., 0.0.0.0 for all interfaces).
  • Port - The port SQL Server is listening on (default: 1433).
  • Instance Name (Optional) - The name of the SQL Server instance, if applicable.
  • Collection Interval (Optional) - The frequency at which data is collected. The default interval is already set to 10s.
  • Computer Name (Optional) - The machine name where SQL Server is running. These fields must be entered in the UI to enable the SQL Server integration.

User-Based Authentication

Overview

To collect SQL Server metrics securely, a non-root user with specific permissions must be created. This guide outlines the steps to install MSSQL Server and SQLCMD using Docker and configure user-based authentication with appropriate permissions.

MSSQL Docker Configuration

We will deploy MSSQL Server and MSSQL Tools in a Docker container.

Deploy the container using:

NOTE: Sometimes MSSQL server fails to start due to insufficient asynchronous I/O contexts. You can increase the contexts by:

User Authentication Setup

To enforce security, a dedicated non-root user (mw_user) will be created with restricted access.

Access MSSQL Container

Step 1: Create a User

Execute the following command to create a new login (mw_user) and associate it with a database user:

NOTE: The -C flag is used to trust the server certificate. Without it, you may encounter the error: "SSL Provider: certificate verify failed: self-signed certificate."

Verify the user creation:

If successful, you will see the following output:

Step 2: Grant Permissions to mw_user

Assign necessary permissions to mw_user:

Step 3: Verify User Permissions

Confirm that mw_user has the necessary access by running:

If the command executes successfully without errors, the user has the correct permissions.

Access Integrations

Step 1: Access SQL Server Integration

Log in to Middleware, navigate to the Installations Page in the bottom left corner, select All Integration and click SQL Server:

SQL Server Access Screen

Step 2: Configure the integration SQL Server

To configure the integration of your Nginx Web Server with our platform.

To configure the integration of your SQL Server with our platform, update the configuration as follows:

  • Collection Interval (Optional): Specify the interval at which telemetry data is collected. In this configuration, two intervals are defined—10s and 5s.
  • Computer Name (Optional): Set the computer name for the SQL Server instance. Here, it is CustomServer.
  • Instance Name (Optional): Define the specific SQL Server instance. Here, it is CustomInstance.
  • Authentication: Provide authentication details (username and password). In this case, the username is sqlserver and the password is sqlserver.
  • Server Address: Specify the server IP or hostname. Here, it is 0.0.0.0.
  • Port: Define the port used by SQL Server. The default port is 1433.
SQL Server Configuration Screen

Conclusion

This setup ensures that SQL Server metrics can be securely collected using a non-root user while maintaining the necessary permissions for observability. By following this guide, you establish a secure and controlled authentication mechanism for MSSQL in a Docker environment.

Visualize Analytics

Default SQL Server Dashboard

Once the SQL Server integration setup is complete, a new SQL Server-specific dashboard will appear in the Dashboard Builder. This default dashboard serves as a jumping off point for visualizing and analyzing SQL Server data.

SQL Server Default Dashboard

Create SQL Server Widget

You can add SQL Server data to dashboards as a custom widget. Follow these steps to configure your widget:

  1. Select Widget Dashboard Navigate to the Create Widget screen.
Create Widget Dashboard Screen
  1. Configure Widget Profile On the Widget Profile screen, define the widget name and description.
Create Widget Profile Screen
  1. Set Up Configuration In the Widget Configuration screen, customize data settings, apply filters, and finalize widget preferences.
Create Widget Configuration Screen

Alerts

Alerts can be configured for any SQL Server metrics. When creating a new rule, select the Database detection method and SQL Server database type for available metrics to appear in the Metrics dropdown list. Select the desired metric and continue configuring the alert conditions.

Metrics Collected

MetricDescription
sqlserver.batch.request.rateNumber of batch requests received by SQL Server.
sqlserver.batch.sql_compilation.rateNumber of SQL compilations needed.
sqlserver.batch.sql_recompilation.rateNumber of SQL recompilations needed.
sqlserver.lock.wait.rateNumber of lock requests resulting in a wait.
sqlserver.lock.wait_time.avgAverage wait time for all lock requests that had to wait.
sqlserver.page.buffer_cache.hit_ratioPages found in the buffer pool without having to read from disk.
sqlserver.page.checkpoint.flush.rateNumber of pages flushed by operations requiring dirty pages to be flushed.
sqlserver.page.lazy_write.rateNumber of lazy writes moving dirty pages to disk.
sqlserver.page.life_expectancyTime a page will stay in the buffer pool.
sqlserver.page.operation.rateNumber of physical database page operations issued.
sqlserver.page.split.rateNumber of pages split as a result of overflowing index pages.
sqlserver.transaction.rateNumber of transactions started for the database (not including XTP-only transactions).
sqlserver.transaction.write.rateNumber of transactions that wrote to the database and committed.
sqlserver.transaction_log.flush.data.rateTotal number of log bytes flushed.
sqlserver.transaction_log.flush.rateNumber of log flushes.
sqlserver.transaction_log.flush.wait.rateNumber of commits waiting for a transaction log flush.
sqlserver.transaction_log.growth.countTotal number of transaction log expansions for a database.
sqlserver.transaction_log.shrink.countTotal number of transaction log shrinks for a database.
sqlserver.transaction_log.usagePercent of transaction log space used.
sqlserver.user.connection.countNumber of users connected to the SQL Server.
sqlserver.database.countThe number of databases.
sqlserver.database.ioThe number of bytes of I/O on this file.
sqlserver.database.latencyTotal time that the users waited for I/O issued on this file.
sqlserver.database.operationsThe number of operations issued on the file.
sqlserver.processes.blockedThe number of processes that are currently blocked.
sqlserver.resource_pool.disk.throttled.read.rateThe number of read operations that were throttled in the last second.
sqlserver.resource_pool.disk.throttled.write.rateThe number of write operations that were throttled in the last second.

Troubleshooting

Missing Integrations Menu

If you do not see the Integrations Menu in Middlware, that means your account has not been granted Installation permissions. Contact your system administrator to add the Installation permission to your user role in Settings.

Next Steps

Need assistance or want to learn more about Middleware? Contact our support team at [email protected].