SQL Server
New announcements from Dash: Incident Management, Continuous Profiler, and more! New announcements from Dash!

SQL Server

Agent Check Agent Check

Supported OS: Linux Mac OS Windows

SQL server Graph


The SQL Server check tracks 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.



The SQL Server check is included in the Datadog Agent package. No additional installation is necessary 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. Make sure your SQL Server instance is listening on a specific fixed port. By default, named instances and SQL Server Express are configured for dynamic ports. See Microsoft’s documentation for more details.



To configure this check for an Agent running on a host:

  1. Edit the sqlserver.d/conf.yaml file, 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. It is also possible to use the Windows Authentication and not specify the username/password with:

      connection_string: "Trusted_Connection=yes"
  2. Restart the Agent.


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 indicated in the odbcinst.ini file.
Log collection

Available for Agent versions >6.0

  1. Collecting logs is disabled by default in the Datadog Agent, enable it in your datadog.yaml file:

    logs_enabled: true
  2. Add this configuration block to your sqlserver.d/conf.yaml file to start collecting your SQL Server logs:

      - type: file
        path: "<LOG_FILE_PATH>"
        source: sqlserver
        service: "<SERVICE_NAME>"

    Change the path and service parameter values based on your environment. See the sample sqlserver.d/conf.yaml for all available configuration options.

  3. Restart the Agent.

See Datadog’s documentation for additional information on how to configure the Agent for log collection in Kubernetes environments.


For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.

Metric collection
<INIT_CONFIG>blank or {}
<INSTANCE_CONFIG>{"host": "%%host%%,%%port%%", "username": "datadog", "password": "<UNIQUEPASSWORD>", "connector": "odbc", "driver": "FreeTDS"}

See Autodiscovery template variables for details on passing <UNIQUEPASSWORD> as an environment variable instead of a label.

Log collection

Available for Agent versions >6.0

Collecting logs is disabled by default in the Datadog Agent. To enable it, see Kubernetes log collection.

<LOG_CONFIG>{"source": "sqlserver", "service": "sqlserver"}


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
Number of current tasks that are associated with this scheduler.
Shown as task
Number of workers that are associated with this scheduler.
Shown as worker
Number of workers that are active. An active worker is never preemptive, must have an associated task, and is either running, runnable, or suspended.
Shown as worker
Number of workers, with tasks assigned to them, that are waiting to be scheduled on the runnable queue.
Shown as task
Number of tasks in the pending queue. These tasks are waiting for a worker to pick them up.
Shown as unit
Number of scheduler context switches that this task has completed.
Shown as unit
Number of physical I/Os that are performed by this task.
Shown as unit
Total byte count of I/Os that are performed by this task.
Shown as byte
Average byte count of I/Os that are performed by this task.
Shown as byte

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.

Further Reading