Configuration de Database Monitoring pour SQL Server auto-hébergé

La solution Database Monitoring n'est pas prise en charge pour ce site.

La solution Database Monitoring pour SQL Server est en version bêta privée. Contactez votre chargé de compte pour demander l'accès à la version bêta.

La solution Database Monitoring vous permet de bénéficier d’une visibilité complète sur vos bases de données Microsoft SQL Server, en exposant des métriques de requête, des échantillons de requête, des plans d’exécution, ainsi que des états, des failovers et des événements de base de données.

Pour activer la solution Database Monitoring pour votre base de données, suivez les étapes ci-dessous :

  1. Autoriser l’Agent à accéder à la base de données
  2. Installer l’Agent

Avant de commencer

Supported Agent versions
7.41.0+
Performance impact
The default Agent configuration for Database Monitoring is conservative, but you can adjust settings such as the collection interval and query sampling rate to better suit your needs. For most workloads, the Agent represents less than one percent of query execution time on the database and less than one percent of CPU.

Database Monitoring runs as an integration on top of the base Agent (see benchmarks).
Proxies, load balancers, and connection poolers
The Agent must connect directly to the host being monitored. The Agent should not connect to the database through a proxy, load balancer, or connection pooler. While this can be an anti-pattern for client applications, for Database Monitoring each Agent must have knowledge of the underlying host and should stick to a single host for its lifetime, even in cases of failover. If the Datadog Agent connects to different hosts while it is running, then the metrics will be incorrect.
Data security considerations
Read about how Database Management handles sensitive information for information about what data the Agent collects from your databases and how to ensure it is secure.

Accorder un accès à l’Agent

L’Agent Datadog requiert un accès en lecture seule pour le serveur de base de données, afin de pouvoir recueillir les statistiques et requêtes.

Créez une connexion en lecture seule pour vous connecter au serveur en attribuant les autorisations requises :

CREATE LOGIN datadog WITH PASSWORD = '<MOT_DE_PASSE>';
CREATE USER datadog FOR LOGIN datadog;
GRANT CONNECT ANY DATABASE to datadog;
GRANT VIEW SERVER STATE to datadog;
GRANT VIEW ANY DEFINITION to datadog;

Installer l’Agent

Il est conseillé d’installer directement l’Agent sur le host SQL Server. En effet, cette approche permet à l’Agent de recueillir de nombreuses données de télémétrie système (processeur, mémoire, disque, réseau), en plus des données de télémétrie propres à SQL Server.

To start collecting SQL Server telemetry, first install the Datadog Agent.

Create the SQL Server Agent conf file C:\ProgramData\Datadog\conf.d\sqlserver.d\conf.yaml. See the sample conf file for all available configuration options.

init_config:
instances:
  - dbm: true
    host: '<HOSTNAME>,<SQL_PORT>'
    username: datadog
    password: '<PASSWORD>'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    include_ao_metrics: true  # Optional: For AlwaysOn users
    tags:  # Optional
      - 'service:<CUSTOM_SERVICE>'
      - 'env:<CUSTOM_ENV>'

To use Windows Authentication, set connection_string: "Trusted_Connection=yes" and omit the username and password fields.

The agent supports SQL Server Browser Service in versions 7.41+. To enable SSBS, provide a port of 0 in the host string: <HOSTNAME>,0.

Use the service and env tags to link your database telemetry to other telemetry through a common tagging scheme. See Unified Service Tagging on how these tags are used throughout Datadog.

Supported Drivers

Microsoft ADO

The recommended ADO provider is Microsoft OLE DB Driver. Ensure the driver is installed on the host where the agent is running.

connector: adodbapi
adoprovider: MSOLEDBSQL19  # Replace with MSOLEDBSQL for versions 18 and lower

The other two providers, SQLOLEDB and SQLNCLI, are considered deprecated by Microsoft and should no longer be used.

ODBC

The recommended ODBC driver is Microsoft ODBC Driver. Ensure the driver is installed on the host where the Agent is running.

connector: odbc
driver: '{ODBC Driver 18 for SQL Server}'

Once all Agent configuration is complete, restart the Datadog Agent.

Validate

Run the Agent’s status subcommand and look for sqlserver under the Checks section. Navigate to the Databases page in Datadog to get started.

To start collecting SQL Server telemetry, first install the Datadog Agent.

On Linux, the Datadog Agent additionally requires an ODBC SQL Server driver to be installed—for example, the Microsoft ODBC driver. Once an ODBC SQL Server is installed, copy the odbc.ini and odbcinst.ini files into the /opt/datadog-agent/embedded/etc folder.

Use the odbc connector and specify the proper driver as indicated in the odbcinst.ini file.

Create the SQL Server Agent conf file /etc/datadog-agent/conf.d/sqlserver.d/conf.yaml. See the sample conf file for all available configuration options.

init_config:
instances:
  - dbm: true
    host: '<HOSTNAME>,<SQL_PORT>'
    username: datadog
    password: '<PASSWORD>'
    connector: odbc
    driver: '<Driver from the `odbcinst.ini` file>'
    include_ao_metrics: true  # Optional: For AlwaysOn users
    tags:  # Optional
      - 'service:<CUSTOM_SERVICE>'
      - 'env:<CUSTOM_ENV>'

Use the service and env tags to link your database telemetry to other telemetry through a common tagging scheme. See Unified Service Tagging on how these tags are used throughout Datadog.

Once all Agent configuration is complete, restart the Datadog Agent.

Validate

Run the Agent’s status subcommand and look for sqlserver under the Checks section. Navigate to the Databases page in Datadog to get started.

Pour aller plus loin