Monitoring SQL Server with Datadog - Choosing Between the Integration and DBM

SQL Server monitoring in Datadog starts with a single check bundled with the Agent, and adding dbm: true to the configuration extends it to query-level Database Monitoring. Centered on where to place the Agent and how to grant permissions, both of which change with the hosting, this article walks through how to create the monitoring login.

Are Connection Counts Enough, or Do You Need to Track Down Slow Queries?

The first thing to decide is how deep the questions you want to answer about SQL Server go. The standard integration is a check included in the Agent package; it needs no additional installation on the SQL Server side and collects performance metrics such as the number of user connections and how often SQL is compiled. If you want to go as far as identifying slow queries, execution plans, wait events, and blocking queries, enable Database Monitoring (DBM) in the configuration of the same check. When you use only the integration, the minimum Agent version is v6.0.0 (as of October 2026; source: SQL Server). DBM requires Agent v7.41.0 or later (source: Setting Up Database Monitoring for self-hosted SQL Server). The full set of screens you can see in DBM and the list of supported databases are left to the explanation of Database Monitoring; here we follow the preparation specific to SQL Server.

What the Hosting Changes Is Where the Agent Goes and Which Permissions You Can Grant

The DBM steps are split into four: your own servers, Amazon RDS, Azure, and Google Cloud SQL. Two conditions create the differences: whether you can place the Agent on the same host as SQL Server, and whether you can directly grant server-level permissions such as CONNECT ANY DATABASE to the monitoring login. Even within Azure, the steps differ between Azure SQL Managed Instance, where you can grant them directly, and Azure SQL Database, where you add the login to server roles. On your own servers, installing the Agent on that host is recommended, and it collects CPU, memory, disk, and network alongside the SQL Server metrics. Because you cannot install directly on the host for the three managed options, you place the Agent on a separate host that can connect to SQL Server.

Differences by hosting (DBM steps; as of October 2026)
HostingWhere the Agent goesHow permissions are grantedBlock to add to the configurationIntegration to install alongside
Your own servers (including SQL Server on Azure VMs)The SQL Server hostGrant at the server level, including CONNECT ANY DATABASE--
Amazon RDSA separate host that can connectCONNECT ANY DATABASE cannot be granted, so create a datadog user in each application databaseinstance_endpoint under aws:Resource collection in the AWS integration and the RDS integration
Azure SQL DatabaseA separate host that can connectAdd to the server roles ##MS_ServerStateReader## and ##MS_DefinitionReader##deployment_type and fully_qualified_domain_name under azure:Azure integration
Azure SQL Managed InstanceA separate host that can connectGrant CONNECT ANY DATABASE / VIEW SERVER STATE / VIEW ANY DEFINITION directly to the logindeployment_type and fully_qualified_domain_name under azure:Azure integration
Google Cloud SQLA separate host that can connectRemove from the default CustomerDbRootRole, grant only the required permissions, then create a user in each databaseproject_id and instance_id under gcp:Cloud SQL integration
Source: the self-hosted / Amazon RDS / Azure / Google Cloud SQL setup steps

When the Agent is on a separate host, it needs to connect directly to the monitored host, and the official documentation asks you not to put a proxy, load balancer, or connection pool in between. If the connection target changes midway, for example through a failover, the Agent ends up taking the difference between the statistics of two hosts, and the metrics become inaccurate. Azure SQL Database treats each database as one host, and even inside an elastic pool each database is a separate host. In the configuration, write one instance for each application database, and do not include system databases such as master.

Grant the Monitoring Login Only Read Permissions

What the Agent needs to collect statistics and queries is read permission on the database server. Every set of steps starts by creating a login named datadog, and the method shown is to keep the password in secrets management software such as Vault and reference it from the Agent configuration in the form ENC[secret_name]. To use this reference, you separately configure how secrets are retrieved (secrets management) in the Agent's datadog.yaml. You use either secret_backend_type, which selects a built-in backend, or secret_backend_command, which points to your own executable (source: Secrets Management). The scope of the permissions to grant differs slightly between using only the integration and enabling DBM.

Main permissions to grant the monitoring login (your own servers; as of October 2026)
PermissionWhat it is used forIntegration onlyDBM
VIEW SERVER STATEReading the server state and statisticsGrantGrant
SELECT on sys.dm_os_performance_countersReading performance countersGrant-
CONNECT ANY DATABASEPer-database file size and I/O statisticsWhen collecting file size metricsGrant (SQL Server 2014 and later)
VIEW ANY DEFINITIONAlwaysOn and sys.master_files metricsWhen collecting those metricsGrant
SELECT on msdbLog shipping monitoring and SQL Server Agent job monitoring-When you use those features
Source: SQL Server / Setting Up Database Monitoring for self-hosted SQL Server

The SQL Server 2012 steps have no CONNECT ANY DATABASE; instead, you create a datadog user in each application database. To connect with a user name and password, set the server properties to the mode that allows both SQL Server authentication and Windows authentication. If you use Windows authentication instead, write connection_string: "Trusted_Connection=yes" in the configuration and omit the user name and password fields. If you narrow the permissions as in the table, then when someone asks about the role of the monitoring login, you can explain on a single page that it is a read-only account.

Write the Configuration in conf.yaml under sqlserver.d, and dbm: true Switches It to DBM

The configuration file is conf.d/sqlserver.d/conf.yaml in the Agent's configuration directory. On Windows, place it at C:\ProgramData\Datadog\conf.d\sqlserver.d\conf.yaml. On Linux, it is /etc/datadog-agent/conf.d/sqlserver.d/conf.yaml. The connection target is a single value joining the host name and port with a comma, and writing 0 for the port lets you use automatic port detection.

instances:
  - dbm: true
    host: '<HOSTNAME>,<PORT>'
    username: datadog
    password: 'ENC[<SECRET_NAME>]'
    tags:
      - 'service:<SERVICE>'
      - 'env:<ENV>'

Align the service and env tags with the values of unified service tagging, which connects database metrics with application-side information.

Components used for the connection (as of October 2026)
Agent hostconnectorDriver settingAdditional work
WindowsadodbapiAn MSOLEDBSQL-family Microsoft OLE DB Driver in adoproviderInstall the driver on the Agent host
LinuxodbcThe name written in odbcinst.ini in driverInstall the ODBC driver and copy odbc.ini and odbcinst.ini to /opt/datadog-agent/embedded/etc
Source: Setting Up Database Monitoring for self-hosted SQL Server

Do not choose the remaining two providers available with ADO on Windows, SQLOLEDB and SQLNCLI, because Microsoft has deprecated them. After writing the configuration, restart the Agent and check whether sqlserver appears in the Checks section of the status subcommand's output. If you enabled DBM, start looking from the Databases screen in Datadog.

Build Values Missing from the Standard Check from Query Results

Most of the standard check's metrics are taken from the sys.dm_os_performance_counters table, and there are two ways to add other values. For a performance counter, write the name in Datadog and the counter_name in custom_metrics, and for a counter that has multiple instances, narrow it to one with instance_name. To use the result of arbitrary SQL, use custom_queries: put the SQL in query, list the result columns in columns from left to right, and for each column specify a type such as gauge or count, or tag to make it a tag. Make the number and order of the columns match the result, and make at least one column a metric type. custom_queries is recommended over the older method that uses stored procedures (source: Collect SQL Server Custom Metrics). How the values added this way are counted is summarized in the glossary entry for custom metrics.

The Minimum Supported Version and How to Connect with AlwaysOn

The oldest version in the list of supported versions is SQL Server 2012, which the official documentation keeps in scope with known limitations (as of October 2026). The versions supported by the standard integration are the same as for DBM; look at the column for your own servers. Some features were introduced in specific versions: log shipping monitoring is available from Agent v7.50, and SQL Server Agent job monitoring from v7.57 (job monitoring covers SQL Server 2016 and later). For AlwaysOn availability groups, the recommended approach is to install the Agent on each replica for your own servers, and for cloud instances to connect to each replica from an Agent on a separate host. Connecting to a single point through the listener is treated as an alternative method. When connecting to multiple instances from one Agent, list one item per host under instances in the configuration.

Two Commands to Confirm That Collection Has Started

The steps for installing the Agent on Windows themselves are covered by installing the Agent on Windows, and the RDS-side integration by the article on monitoring RDS. The host where you place the Agent is determined by which row of the hosting table the instance you want to monitor falls into. If you confirm with the SQL Server management tools that you can connect from that host with the monitoring login, then when an error appears you can narrow what to suspect to the configuration file. With the Linux Agent, run the following two commands after restarting.

sudo datadog-agent check sqlserver
sudo datadog-agent status

The first runs the specified check on the spot and displays the result. If sqlserver is listed under Running Checks in the output of the second without warnings or errors, collection has started (as of October 2026; source: Agent Commands).

References

Share