The SQL Server integration tracks the performance of your SQL Server instances. It collects metrics for number of user connections, rate of SQL compilations, and more.
Enable Database Monitoring (DBM) for enhanced insight into query performance and database health. In addition to the standard integration, Datadog DBM provides query-level metrics, live and historical query snapshots, wait event analysis, database load, query explain plans, and blocking query insights.
SQL Server 2012, 2014, 2016, 2017, 2019, 2022, and 2025 are supported.
Minimum Agent version: 6.0.0
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
Note: To install Database Monitoring for SQL Server, select your hosting solution on the documentation site for instructions.
Supported versions of SQL Server for the SQL Server check are the same as for Database Monitoring. Visit the Setting up SQL Server page to see the currently supported versions under the Self-hosted heading.
Proceed with the following steps in this guide only if you are installing the standard integration alone.
-
Create a read-only login to connect to your server:
CREATE LOGIN datadog WITH PASSWORD = '<PASSWORD>'; USE master; CREATE USER datadog FOR LOGIN datadog; GRANT SELECT on sys.dm_os_performance_counters to datadog; GRANT VIEW SERVER STATE to datadog;
To collect file size metrics per database, ensure the user you created (
datadog) has connect permission access to your databases by running:GRANT CONNECT ANY DATABASE to datadog; -
(Required for AlwaysOn and
sys.master_filesmetrics) To gather AlwaysOn andsys.master_filesmetrics, grant the following additional permission:GRANT VIEW ANY DEFINITION to datadog;
To configure this check for an Agent running on a host:
-
Edit the
sqlserver.d/conf.yamlfile, in theconf.d/folder at the root of your Agent's configuration directory. See the sample sqlserver.d/conf.yaml for all available configuration options:init_config: instances: - host: "<SQL_HOST>,<SQL_PORT>" username: datadog password: "<YOUR_PASSWORD>" connector: adodbapi adoprovider: MSOLEDBSQL19 # Replace with MSOLEDBSQL for versions 18 and previous
If you use port autodiscovery, use
0forSQL_PORT. See the example check configuration for a comprehensive description of all options, including how to use custom queries to create your own metrics.Use supported drivers based on your SQL Server setup.
Note: It is also possible to use the Windows Authentication and not specify the username/password with:
connection_string: "Trusted_Connection=yes"
Extra configuration steps are required to get the SQL Server integration running on a Linux host:
- Install an ODBC SQL Server driver, for example the Microsoft ODBC driver or the FreeTDS driver.
- Copy the
odbc.iniandodbcinst.inifiles into the/opt/datadog-agent/embedded/etcfolder. - Configure the
conf.yamlfile to use theodbcconnector and specify the proper driver as indicated in theodbcinst.inifile.
Available for Agent versions >6.0
-
Collecting logs is disabled by default in the Datadog Agent, enable it in your
datadog.yamlfile:logs_enabled: true
-
Add this configuration block to your
sqlserver.d/conf.yamlfile to start collecting your SQL Server logs:logs: - type: file encoding: utf-16-le path: "<LOG_FILE_PATH>" source: sqlserver service: "<SERVICE_NAME>"
Change the
pathandserviceparameter values based on your environment. See the sample sqlserver.d/conf.yaml for all available configuration options.
For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.
| Parameter | Value |
|---|---|
<INTEGRATION_NAME> |
sqlserver |
<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.
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent. To enable it, see Kubernetes Log Collection.
| Parameter | Value |
|---|---|
<LOG_CONFIG> |
{"source": "sqlserver", "service": "sqlserver"} |
Run the Agent's status subcommand and look for sqlserver under the Checks section.
See metadata.csv for a list of metrics provided by this check.
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.
See service_checks.json for a list of service checks provided by this integration.
Need help? Contact Datadog support.
If you are running the Agent on an ARM aarch64 processor, there is a known issue starting in version 14.0.0 of this check, which is bundled with Agent version 7.48.0. A Python dependency fails to load, and you'll see the following message when running the Agent's status subcommand:
Loading Errors
==============
sqlserver
---------
Core Check Loader:
Check sqlserver not found in Catalog
JMX Check Loader:
check is not a jmx check, or unable to determine if it's so
Python Check Loader:
unable to import module 'sqlserver': No module named 'sqlserver'
This is fixed in version 15.2.0 of the check and in Agent versions 7.49.1 and above.
- Monitor your Azure SQL Databases with Datadog
- Key metrics for SQL Server monitoring
- SQL Server monitoring tools
- Monitor SQL Server performance with Datadog
- Custom SQL Server metrics for detailed monitoring
- Strategize your Azure migration for SQL workloads with Datadog
- Optimize SQL Server performance with Datadog Database Monitoring
