New announcements for Serverless, Network, RUM, and more from Dash! New announcements from Dash!

SQL Server

Agent Check Agent Check

Supported OS: Linux Windows

SQL server Graph


This check lets you track the performance of your SQL Server instances. It collects metrics for number of user connections, rate of SQL compilations, and more.

You can also create your own metrics by having the check run custom queries.


Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the Autodiscovery Integration Templates for guidance on applying these instructions.


The SQL Server check is included in the Datadog Agent package, so you don’t need to install anything else on your SQL Server instances.

Make sure that your SQL Server instance supports SQL Server authentication by enabling “SQL Server and Windows Authentication mode” in the server properties. Server Properties -> Security -> SQL Server and Windows Authentication mode


  1. Create a read-only login to connect to your server:

        CREATE USER datadog FOR LOGIN datadog;
        GRANT SELECT on sys.dm_os_performance_counters to datadog;
        GRANT VIEW SERVER STATE to datadog;
  2. Create a file sqlserver.d/conf.yaml, in the conf.d/ folder at the root of your Agent’s configuration directory. See the sample sqlserver.d/conf.yaml for all available configuration options:

          - host: <SQL_HOST>,<SQL_PORT>
            username: datadog
            password: <YOUR_PASSWORD>
            connector: odbc # alternative is 'adodbapi'
            driver: SQL Server

    See the example check configuration for a comprehensive description of all options, including how to use custom queries to create your own metrics.

    Note: The (default) provider SQLOLEDB is being deprecated. To use the newer MSOLEDBSQL provider, set the adoprovider variable to MSOLEDBSQL in your sqlserver.d/conf.yaml file after having downloaded the new provider from Microsoft. Note: It is also possible to use the Windows Authentication and not specify the username/password with

    connection_string: "Trusted_Connection=yes"
  3. Restart the Agent to start sending SQL Server metrics to Datadog.


Extra configuration steps are required to get the SQL Server integration running on a Linux host:

  1. Install an ODBC SQL Server Driver, for example the Microsoft ODBC Driver.
  2. Copy the odbc.ini and odbcinst.ini files into the /opt/datadog-agent/embedded/etc folder.
  3. Configure the conf.yaml file to use the odbc connector and specify the proper driver as specified in the odbcinst.ini file.


Run the Agent’s status subcommand and look for sqlserver under the Checks section.

Data Collected


The ratio of data pages found and read from the buffer cache over all data page requests.
Shown as fraction
Duration that a page resides in the buffer pool.
Shown as second
The number of batch requests per second.
Shown as request
The number of SQL compilations per second.
Shown as operation
The number of SQL re-compilations per second.
Shown as operation
The number of user connections.
Shown as connection
The number of times per second that SQL Server is unable to retain a lock right away for a resource.
Shown as lock
The number of page splits per second.
Shown as operation
The number of processes blocked.
Shown as process
The number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed.
Shown as page

Most of these metrics come from your SQL Server’s sys.dm_os_performance_counters table.


The SQL server check does not include any events.

Service Checks


Returns CRITICAL if the Agent cannot connect to SQL Server to collect metrics, otherwise OK.


Need help? Contact Datadog support.


See the main documentation for more details about how to test and develop Agent based integrations.

Testing Guidelines


To run the tests on Windows, an instance of MSSQL is expected to run on the host. The name of the database instance and the credentials reflect what we have on the CI environment, so that might not work out of the box on a local development environment.


On Linux, a Docker container running a MSSQL instance is automatically started before running the tests. We use unixODBC and FreeTDS to talk to the database so, depending on the Linux distribution, you need to install additional dependencies on your local dev environment before running the tests. For example these are the installation steps for Ubuntu 14.04:

sudo apt-get install unixodbc unixodbc-dev tdsodbc


Same as Linux, MSSQL runs in a Docker container and we talk to the database through unixODBC and FreeTDS. You can use homebrew to install the required packages:

brew install unixodbc
brew install freetds --with-unixodbc

Further Reading

Mistake in the docs? Feel free to contribute!