Azure SQL Server용 Database Monitoring 설정

Database Monitoring은 쿼리 메트릭, 쿼리 샘플, 실행 계획, 데이터베이스 상태, 장애 조치, 이벤트와 같은 정보를 노출하여 Microsoft SQL Server 데이터베이스에 관한 상세한 정보를 가시화합니다.

데이터베이스에서 Database Monitoring을 활성화하려면 다음 단계를 따르세요.

  1. Agent에 데이터베이스 액세스 권한 부여
  2. Agent 설치 및 구성
  3. Azure 통합 설치

시작 전 참고 사항

지원되는 SQL Server 버전
2014, 2016, 2017, 2019, 2022, 2025(Agent 7.79+ 필요)
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 Datadog 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. If the Agent connects to different hosts while it is running (as in the case of failover, load balancing, and so on), the Agent calculates the difference in statistics between two hosts, producing inaccurate metrics.
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.
RDS Custom
Datadog supports DBM for some RDS Custom configurations that make OS-level changes. This support depends on the customizations stable compatibility with DBM.

Agent에 액세스 권한 부여

Datadog Agent가 통계 및 쿼리를 수집하려면 데이터베이스 서버에 대한 읽기 전용 액세스 권한이 필요합니다.

읽기 전용 로그인을 생성하여 서버에 연결하고 필요한 Azure SQL 역할을 부여하세요.

CREATE LOGIN datadog WITH PASSWORD = '<PASSWORD>';
CREATE USER datadog FOR LOGIN datadog;
ALTER SERVER ROLE ##MS_ServerStateReader## ADD MEMBER datadog;
ALTER SERVER ROLE ##MS_DefinitionReader## ADD MEMBER datadog;
-- If not using either of Log Shipping Monitoring (available in Agent v7.50+) or
-- SQL Server Agent Monitoring (available in Agent v7.57+), comment out the next three lines:
USE msdb;
CREATE USER datadog FOR LOGIN datadog;
GRANT SELECT to datadog;

이 서버에 있는 각 추가 Azure SQL 데이터베이스에 접근할 수 있도록 에이전트에 권한을 부여합니다.

CREATE USER datadog FOR LOGIN datadog;

참고: Microsoft Entra ID 관리형 ID 인증도 지원됩니다. Azure SQL DB 인스턴스에 대해 이를 구성하는 방법은 가이드를 참조하세요.

Datadog Agent를 구성할 때 특정 Azure SQL DB 서버에 있는 각 애플리케이션 데이터베이스에 대해 하나의 검사 인스턴스를 지정하세요. master 및 기타 시스템 데이터베이스는 포함하지 마세요. 개별 데이터베이스는 격리된 컴퓨팅 환경에서 실행되므로 Datadog Agent는 Azure SQL DB의 각 애플리케이션 데이터베이스에 직접 연결해야 합니다. database_autodiscovery가 Azure SQL DB에서 작동하지 않음을 의미하기도 하므로 활성화해서는 안 됩니다.

참고: Azure SQL 데이터베이스는 격리된 네트워크에서 데이터베이스를 배포하며, 각 데이터베이스는 단일 호스트로 취급됩니다. 즉, 엘라스틱 풀에서 Azure SQL 데이터베이스를 실행하는 경우 풀의 각 데이터베이스는 별도의 호스트로 취급됩니다.

init_config:
instances:
  - host: '<SERVER_NAME>.database.windows.net,<PORT>'
    database: '<DATABASE_1>'
    username: datadog
    password: '<PASSWORD>'
    connector: 'odbc'
    driver: 'ODBC Driver 18 for SQL Server'
    # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
    azure:
      deployment_type: 'sql_database'
      fully_qualified_domain_name: '<SERVER_NAME>.database.windows.net'

  - host: '<SERVER_NAME>.database.windows.net,<PORT>'
    database: '<DATABASE_2>'
    username: datadog
    password: '<PASSWORD>'
    connector: 'odbc'
    driver: 'ODBC Driver 18 for SQL Server'
    # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
    azure:
      deployment_type: 'sql_database'
      fully_qualified_domain_name: '<SERVER_NAME>.database.windows.net'

Datadog Agent를 설치하고 구성하는 방법에 관한 상세한 지침은 Agent 설치를 참고하세요.

읽기 전용 로그인을 생성하여 서버에 연결하고 필요한 권한을 부여하세요.

SQL Server 버전 2014+의 경우

CREATE LOGIN datadog WITH PASSWORD = '<PASSWORD>';
CREATE USER datadog FOR LOGIN datadog;
GRANT CONNECT ANY DATABASE to datadog;
GRANT VIEW SERVER STATE to datadog;
GRANT VIEW ANY DEFINITION to datadog;
-- If not using either of Log Shipping Monitoring (available in Agent v7.50+) or
-- SQL Server Agent Monitoring (available in Agent v7.57+), comment out the next three lines:
USE msdb;
CREATE USER datadog FOR LOGIN datadog;
GRANT SELECT to datadog;

참고: Azure 관리형 ID 인증도 지원됩니다. Azure SQL DB 인스턴스에 대해 이를 구성하는 방법은 가이드를 참조하세요.

Windows Azure VM의 SQL Server의 경우 Windows Server 호스트 VM에 바로 Datadog Agent를 설치하려면 자체 호스팅 SQL Server에서 Database Monitoring 설정 설명서에 안내된 지침을 따르세요.

비밀번호 안전하게 저장

Store your password using secret management software such as Vault. You can then reference this password as ENC[<SECRET_NAME>] in your Agent configuration files: for example, ENC[datadog_user_database_password]. See Secrets Management for more information.

The examples on this page use datadog_user_database_password to refer to the name of the secret where your password is stored. It is possible to reference your password in plain text, but this is not recommended.

Agent 설치 및 구성

Azure는 직접적인 호스트 액세스 권한 부여하지 않기 때문에 Datadog Agent는 SQL Server 호스트와 통신할 수 있는 별도의 호스트에 설치되어야 합니다. Agent를 설치하고 실행하는 데 몇 가지 옵션이 있습니다.

SQL Server 텔레메트리 수집을 시작하려면 우선 Datadog Agent를 설치합니다.

SQL Server Agent conf 파일 C:\ProgramData\Datadog\conf.d\sqlserver.d\conf.yaml을 생성합니다. 사용 가능한 모든 구성 옵션은 샘플 conf 파일을 참조하세요.

init_config:
instances:
  - dbm: true
    host: '<HOSTNAME>,<PORT>'
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    tags:  # Optional
      - 'service:<CUSTOM_SERVICE>'
      - 'env:<CUSTOM_ENV>'
    # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
    azure:
      deployment_type: '<DEPLOYMENT_TYPE>'
      fully_qualified_domain_name: '<AZURE_INSTANCE_ENDPOINT>'

deployment_type 및 fully_qualified_domain_name 필드 설정에 관한 자세한 정보는 SQL Server 통합 사양을 참조하세요.

Windows Authentication을 사용하려면 connection_string: "Trusted_Connection=yes"를 설정하고 username 및 password 필드를 생략합니다.

service 및 env 태그를 사용하여 데이터베이스 텔레메트리를 공통의 태깅 체계를 통해 다른 텔레메트리와 연결합니다. 이러한 태그가 Datadog 전반에서 어떻게 사용되는지는 Unified Service Tagging을 참조하세요.

지원되는 드라이버

Microsoft ADO

권장 ADO 공급자는 Microsoft OLE DB Driver입니다. Agent가 실행되는 호스트에 드라이버를 설치해야 합니다.

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

다른 두 공급자 SQLOLEDB 및 SQLNCLI는 Microsoft에서 지원이 중단된 것으로 간주되며, 더 이상 사용해서는 안 됩니다.

ODBC

권장 ODBC 드라이버는 Microsoft ODBC Driver입니다. Agent 7.51부터는 SQL Server용 ODBC Driver 18이 Linux용 Agent에 포함되어 있습니다. Windows의 경우, Agent가 실행 중인 호스트에 드라이버를 설치해야 합니다.

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

모든 Agent 구성이 완료되었으면 Datadog Agent를 재시작합니다.

검증

Agent의 상태 하위 명령을 실행하고 검사 섹션에서 sqlserver를 찾습니다. Datadog의 데이터베이스 페이지로 이동하여 시작합니다.

SQL Server 텔레메트리 수집을 시작하려면 우선 Datadog Agent를 설치합니다.

Linux에서 Datadog Agent는 추가로 ODBC SQL Server 드라이버(예: Microsoft ODBC 드라이버)를 설치해야 합니다. ODBC SQL Server가 설치되면 odbc.ini 및 odbcinst.ini 파일을 /opt/datadog-agent/embedded/etc 폴더로 복사하세요.

odbc 커넥터를 사용하고 odbcinst.ini 파일에 표시된 것과 같이 적절한 드라이버를 지정합니다.

SQL Server Agent conf 파일 /etc/datadog-agent/conf.d/sqlserver.d/conf.yaml을 생성합니다. 사용 가능한 모든 구성 옵션은 샘플 conf 파일을 참조하세요.

init_config:
instances:
  - dbm: true
    host: '<HOSTNAME>,<PORT>'
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    connector: odbc
    driver: '<Driver from the `odbcinst.ini` file>'
    tags:  # Optional
      - 'service:<CUSTOM_SERVICE>'
      - 'env:<CUSTOM_ENV>'
    # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
    azure:
      deployment_type: '<DEPLOYMENT_TYPE>'
      fully_qualified_domain_name: '<AZURE_ENDPOINT_ADDRESS>'

deployment_type 및 fully_qualified_domain_name 필드 설정에 관한 자세한 정보는 SQL Server 통합 사양을 참조하세요.

service 및 env 태그를 사용하여 데이터베이스 텔레메트리를 공통의 태깅 체계를 통해 다른 텔레메트리와 연결합니다. 이러한 태그가 Datadog 전반에서 어떻게 사용되는지는 Unified Service Tagging을 참조하세요.

모든 Agent 구성이 완료되었으면 Datadog Agent를 재시작합니다.

검증

Agent의 상태 하위 명령을 실행하고 검사 섹션에서 sqlserver를 찾습니다. Datadog의 데이터베이스 페이지로 이동하여 시작합니다.

Docker 컨테이너에서 실행되는 Database Monitoring Agent를 구성하려면 Agent 컨테이너에서 Autodiscovery Integration 템플릿을 Docker 레이블로 설정합니다.

참고: 레이블에 대한 Autodiscovery가 작동하려면 Agent에 Docker 소켓에 대한 읽기 권한이 있어야 합니다.

값을 계정 및 환경과 일치하도록 교체합니다. 사용 가능한 모든 구성 옵션은 샘플 conf 파일을 참조하세요.

export DD_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export DD_AGENT_VERSION=<AGENT_VERSION>

docker run -e "DD_API_KEY=${DD_API_KEY}" \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -l com.datadoghq.ad.check_names='["sqlserver"]' \
  -l com.datadoghq.ad.init_configs='[{}]' \
  -l com.datadoghq.ad.instances='[{
    "dbm": true,
    "host": "<HOSTNAME>,<PORT>",
    "connector": "odbc",
    "driver": "ODBC Driver 18 for SQL Server",
    "username": "datadog",
    "password": "<PASSWORD>",
    "tags": [
      "service:<CUSTOM_SERVICE>"
      "env:<CUSTOM_ENV>"
    ],
    "azure": {
      "deployment_type": "<DEPLOYMENT_TYPE>",
      "fully_qualified_domain_name": "<AZURE_ENDPOINT_ADDRESS>"
    }
  }]' \
  registry.datadoghq.com/agent:${DD_AGENT_VERSION}

deployment_type 및 fully_qualified_domain_name 필드 설정에 관한 자세한 정보는 SQL Server 통합 사양을 참조하세요.

service 및 env 태그를 사용하여 데이터베이스 텔레메트리를 공통의 태깅 체계를 통해 다른 텔레메트리와 연결합니다. 이러한 태그가 Datadog 전반에서 어떻게 사용되는지는 Unified Service Tagging을 참조하세요.

검증

Agent의 상태 하위 명령을 실행하고 검사 섹션에서 sqlserver를 찾습니다. 또는 Datadog의 데이터베이스 페이지로 이동하여 시작합니다.

Kubernetes 클러스터를 실행 중인 경우 Database Monitoring을 활성화하려면 Datadog Cluster Agent를 사용하세요. 클러스터 검사가 이미 활성화되어 있지 않은 경우, 이 지침을 따라 활성화한 다음에 계속 진행합니다.

Operator

아래 단계를 따라 SQL Server 통합을 설정합니다. Kubernetes and Integrations의 Operator 지침을 참고 자료로 사용하세요.

  1. 다음 구성을 사용하여 datadog-agent.yaml 파일을 생성 또는 업데이트합니다.

    apiVersion: datadoghq.com/v2alpha1
    kind: DatadogAgent
    metadata:
      name: datadog
    spec:
      global:
        clusterName: <CLUSTER_NAME>
        site: <DD_SITE>
        credentials:
          apiSecret:
            secretName: datadog-agent-secret
            keyName: api-key
    
      features:
        clusterChecks:
          enabled: true
    
      override:
        nodeAgent:
          image:
            name: agent
            tag: <AGENT_VERSION>
    
        clusterAgent:
          extraConfd:
            configDataMap:
              sqlserver.yaml: |-
                cluster_check: true # Make sure to include this flag
                init_config:
                instances:
                - host: <HOSTNAME>,<PORT>
                  username: datadog
                  password: 'ENC[datadog_user_database_password]'
                  connector: 'odbc'
                  driver: 'ODBC Driver 18 for SQL Server'
                  dbm: true
                  # Optional: For additional tags
                  tags:
                    - 'service:<CUSTOM_SERVICE>'
                    - 'env:<CUSTOM_ENV>'
                  # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
                  azure:
                    deployment_type: '<DEPLOYMENT_TYPE>'
                    fully_qualified_domain_name: '<AZURE_ENDPOINT_ADDRESS>'
    
  2. 다음 명령을 사용하여 변경 사항을 Datadog Operator에 적용합니다.

    kubectl apply -f datadog-agent.yaml
    

Helm

Kubernetes 클러스터에서 Datadog Cluster Agent를 설치하려면 다음 단계를 완료합니다. 값을 계정 및 환경과 일치하도록 교체합니다.

  1. Helm에 대한 Datadog Agent 설치 지침대로 완료합니다.

  2. YAML 구성 파일(Cluster Agent 설치 지침의 datadog-values.yaml)이 다음을 포함하도록 업데이트합니다.

    clusterAgent:
      confd:
        sqlserver.yaml: |-
          cluster_check: true # Required for cluster checks
          init_config:
          instances:
          - dbm: true
            host: <HOSTNAME>,<PORT>
            username: datadog
            password: 'ENC[datadog_user_database_password]'
            connector: 'odbc'
            driver: 'ODBC Driver 18 for SQL Server'
            # Optional: For additional tags
            tags:
              - 'service:<CUSTOM_SERVICE>'
              - 'env:<CUSTOM_ENV>'
            # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
            azure:
              deployment_type: '<DEPLOYMENT_TYPE>'
              fully_qualified_domain_name: '<AZURE_ENDPOINT_ADDRESS>'
    
    clusterChecksRunner:
      enabled: true
    
  3. 명령줄에서 위의 구성 파일을 사용하여 Agent 배포:

    helm install datadog-agent -f datadog-values.yaml datadog/datadog
    
Windows에서는 --set targetSystem=windows 를 helm install 명령에 추가합니다.

마운팅된 파일로 구성

마운팅된 구성 파일을 사용하여 클러스터 검사를 구성하려면, 구성 파일을 Cluster Agent 컨테이너의 경로 /conf.d/sqlserver.yaml에 마운팅합니다.

cluster_check: true  # Make sure to include this flag
init_config:
instances:
  - dbm: true
    host: <HOSTNAME>,<PORT>
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    connector: 'odbc'
    driver: 'ODBC Driver 18 for SQL Server'
    # Optional: For additional tags
    tags:
      - 'service:<CUSTOM_SERVICE>'
      - 'env:<CUSTOM_ENV>'
    # After adding your project and instance, configure the Datadog Azure integration to pull additional cloud data such as CPU, Memory, etc.
    azure:
      deployment_type: '<DEPLOYMENT_TYPE>'
      fully_qualified_domain_name: '<AZURE_ENDPOINT_ADDRESS>'

Kubernetes 서비스 주석으로 구성

파일을 마운팅하지 않고 인스턴스 구성을 Kubernetes Service로 선언할 수 있습니다. Kubernetes에서 실행되는 Agent에 이 검사를 구성하려면 다음 구문을 사용하여 서비스를 생성합니다.

apiVersion: v1
kind: Service
metadata:
  name: sqlserver-datadog-check-instances
  annotations:
    ad.datadoghq.com/service.check_names: '["sqlserver"]'
    ad.datadoghq.com/service.init_configs: '[{}]'
    ad.datadoghq.com/service.instances: |
      [
        {
          "dbm": true,
          "host": "<HOSTNAME>,<PORT>",
          "username": "datadog",
          "password": "ENC[datadog_user_database_password]",
          "connector": "odbc",
          "driver": "ODBC Driver 18 for SQL Server",
          "tags": ["service:<CUSTOM_SERVICE>", "env:<CUSTOM_ENV>"],
          "azure": {
            "deployment_type": "<DEPLOYMENT_TYPE>",
            "fully_qualified_domain_name": "<AZURE_ENDPOINT_ADDRESS>"
          }
        }
      ]
spec:
  ports:
  - port: 1433
    protocol: TCP
    targetPort: 1433
    name: sqlserver

deployment_type 및 fully_qualified_domain_name 필드 설정에 관한 자세한 정보는 SQL Server 통합 사양을 참조하세요.

Cluster Agent가 자동으로 이 구성을 등록하고 SQL Server 검사를 실행하기 시작합니다.

datadog 사용자의 비밀번호가 일반 텍스트로 노출되지 않도록 하려면 Agent의 시크릿 관리 패키지를 사용하고 ENC[] 구문을 사용하여 비밀번호를 선언하세요.

Agent 구성 예시

Connecting with DSN using the ODBC driver on Linux

  1. Locate the odbc.ini and odbcinst.ini files. By default, these are placed in the /etc directory when installing ODBC.

  2. Copy the odbc.ini and odbcinst.ini files into the /opt/datadog-agent/embedded/etc folder.

  3. Configure your DSN settings as follows:

    odbcinst.ini must provide at least one section header and ODBC driver location.

    Example:

    [ODBC Driver 18 for SQL Server]
    Description=Microsoft ODBC Driver 18 for SQL Server
    Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.3.so.2.1
    UsageCount=1
    

    odbc.ini must provide a section header and a Driver path that matches odbcinst.ini.

    Example:

    [datadog]
    Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.3.so.2.1
    
  4. Update the /etc/datadog-agent/conf.d/sqlserver.d/conf.yaml file with your DSN information.

    Example:

    instances:
      - dbm: true
        host: 'localhost,1433'
        username: datadog
        password: 'ENC[datadog_user_database_password]'
        connector: 'odbc'
        driver: 'ODBC Driver 18 for SQL Server' # This is the section header of odbcinst.ini
        dsn: 'datadog' # This is the section header of odbc.ini
    
  5. Restart the Agent.

Using AlwaysOn

For AlwaysOn users, the Agent should be installed on each replica server and connected directly to each replica. The full set of AlwaysOn telemetry is collected from each individual replica, in addition to host-based telemetry (CPU, disk, memory, and so on) for each server.

instances:
  - dbm: true
    host: 'shopist-prod,1433'
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    database_metrics:
      # If Availability Groups is enabled
      ao_metrics:
        enabled: true
      # If Failover Clustering is enabled
      fci_metrics:
        enabled: true

Monitoring SQL Server Agent Jobs

To enable monitoring of SQL Server Agent jobs, the Datadog Agent must have access to the [msdb] database.
SQL Server Agent Jobs monitoring is not available for Azure SQL Database.

Monitoring of SQL Server Agent jobs is supported on SQL Server versions 2016 and newer. Starting from Agent v7.57, the Datadog Agent can collect SQL Server Agent job metrics and histories. To enable this feature, set enabled to true in the agent_jobs section of the SQL Server integration configuration file. The collection_interval and history_row_limit fields are optional.

instances:
  - dbm: true
    host: 'shopist-prod,1433'
    username: datadog
    password: '<PASSWORD>'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    agent_jobs:
      enabled: true
      collection_interval: 15
      history_row_limit: 10000

Collecting schemas

Datadog Agent v7.56+ and SQL Server 2017 or higher are required for SQL Server schema collection.

To enable this feature, use the collect_schemas option. Schemas are collected on databases for which the Agent has CONNECT access.

To collect schema information from RDS instances, you must grant the datadog user explicit CONNECT access to each database on the instance. For more information, see Grant the Agent access.

Use the database_autodiscovery option to avoid specifying each logical database. See the sample sqlserver.d/conf.yaml for more details.

init_config:
instances:
 # This instance detects every logical database automatically
  - dbm: true
        host: 'shopist-prod,1433'
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    database_autodiscovery: true
    collect_schemas:
      enabled: true
    database_metrics:
      # Optional: enable metric collection for indexes
      index_usage_metrics:
        enabled: true
# This instance only collects schemas and index metrics from the `users` database
  - dbm: true
        host: 'shopist-prod,1433'
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    database: users
    collect_schemas:
      enabled: true
    database_metrics:
      # Optional: enable metric collection for indexes
      index_usage_metrics:
        enabled: true

Note: For Agent v7.68 and below, use schemas_collection instead of collect_schemas.

One Agent connecting to multiple hosts

It is common to configure a single Agent host to connect to multiple remote database instances (see Agent installation architectures for DBM). To connect to multiple hosts, create an entry for each host in the SQL Server integration config.

Datadog recommends using one Agent to monitor no more than 30 database instances.

Benchmarks show that one Agent running on a t4g.medium EC2 instance (2 CPUs and 4GB of RAM) can successfully monitor 30 RDS db.t3.medium instances (2 CPUs and 4GB of RAM).
init_config:
instances:
  - dbm: true
    host: 'example-service-primary.example-host.com,1433'
    username: datadog
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    password: 'ENC[datadog_user_database_password]'
    tags:
      - 'env:prod'
      - 'team:team-discovery'
      - 'service:example-service'
  - dbm: true
    host: 'example-service–replica-1.example-host.com,1433'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    tags:
      - 'env:prod'
      - 'team:team-discovery'
      - 'service:example-service'
  - dbm: true
    host: 'example-service–replica-2.example-host.com,1433'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    tags:
      - 'env:prod'
      - 'team:team-discovery'
      - 'service:example-service'
    [...]

Running custom queries

To collect custom metrics, use the custom_queries option. See the sample sqlserver.d/conf.yaml for more details.

init_config:
instances:
  - dbm: true
    host: 'localhost,1433'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    custom_queries:
    - query: SELECT age, salary, hours_worked, name FROM hr.employees;
      columns:
        - name: custom.employee_age
          type: gauge
        - name: custom.employee_salary
           type: gauge
        - name: custom.employee_hours
           type: count
        - name: name
           type: tag
      tags:
        - 'table:employees'

Working with hosts through a remote proxy

If the Agent must connect to a database host through a remote proxy, all telemetry is tagged with the hostname of the proxy rather than the database instance. Use the reported_hostname option to set a custom override of the hostname detected by the Agent.

init_config:
instances:
  - dbm: true
    host: 'localhost,1433'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    reported_hostname: products-primary
  - dbm: true
    host: 'localhost,1433'
    connector: adodbapi
    adoprovider: MSOLEDBSQL
    username: datadog
    password: 'ENC[datadog_user_database_password]'
    reported_hostname: products-replica-1

Discovering ports automatically

SQL Server Browser Service, Named Instances, and other services can automatically detect port numbers. You can use this instead of hardcoding port numbers in connection strings. To use the Agent with one of these services, set the port field to 0.

For example, a Named Instance config:

init_config:
instances:
  - host: <hostname\instance name>
    port: 0

Azure 통합 설치

Azure에서 좀 더 포괄적인 데이터베이스 메트릭과 로그를 수집하려면 Azure 통합을 설치하세요.

추가 자료