본문 바로가기
WIKI 기술 지식 베이스

Amazon RDS의 SQL Server용 데이터베이스 모니터링 설정

원문 보기 위키 갱신

Database Monitoring은 Microsoft SQL Server 데이터베이스에 대한 깊은 가시성을 제공해요. 쿼리 메트릭, 쿼리 샘플, 실행 계획(explain plan), 데이터베이스 상태, 장애 조치(failover), 이벤트까지 한눈에 볼 수 있어요.

데이터베이스에서 Database Monitoring을 활성화하려면 다음 단계를 진행해요.

  1. AWS 통합 설정
  2. Agent 접근 권한 부여
  3. Agent 설치
  4. RDS 통합 설치

출처: 문서

본문

시작하기 전에

{% dl %}

{% dt %} 지원되는 SQL Server 버전 {% /dt %}

{% dd %} 2014, 2016, 2017, 2019, 2022 {% /dd %}

{% dt %} 지원되는 Agent 버전 {% /dt %}

{% dd %} 7.41.0+ {% /dd %}

{% dt %} 성능 영향 {% /dt %}

{% dd %} Database Monitoring의 기본 Agent 설정은 보수적이지만, 수집 간격이나 쿼리 샘플링 비율 같은 설정은 필요에 맞게 조정할 수 있어요. 대부분의 워크로드에서 Agent는 데이터베이스의 쿼리 실행 시간의 1% 미만, CPU의 1% 미만을 차지합니다. Database Monitoring은 기본 Agent 위에서 통합(integration)으로 실행돼요 (벤치마크 참고). {% /dd %}

{% dt %} 프록시, 로드 밸런서, 커넥션 풀러 {% /dt %}

{% dd %} Datadog Agent는 모니터링 대상 호스트에 직접 연결해야 해요. Agent는 프록시, 로드 밸런서, 커넥션 풀러를 통해 데이터베이스에 연결하면 안 됩니다. 실행 중에 Agent가 다른 호스트에 연결하면(장애 조치, 로드 밸런싱 등) 두 호스트 간의 통계 차이를 계산하므로 부정확한 메트릭이 만들어져요. {% /dd %}

{% dt %} 데이터 보안 고려 사항 {% /dt %}

{% dd %} Agent가 데이터베이스에서 수집하는 데이터와 안전하게 보호하는 방법에 대해서는 Database Management가 민감 정보를 어떻게 처리하는지 읽어보세요. {% /dd %}

{% dt %} RDS Custom {% /dt %}

{% dd %} Datadog는 OS 수준 변경을 하는 일부 RDS Custom 구성에 대해 DBM을 지원해요. 이 지원은 커스터마이제이션이 DBM과 안정적으로 호환되는지에 따라 달라져요. {% /dd %}

{% /dl %}

AWS 통합 설정

Amazon Web Services 통합 타일의 Resource Collection 섹션에서 Standard Collection을 활성화하세요.

Agent 접근 권한 부여

Datadog Agent는 통계와 쿼리를 수집하려면 데이터베이스 서버에 대한 읽기 전용 접근이 필요해요.

서버에 연결할 읽기 전용 로그인을 만들고 필요한 권한을 부여하세요:

USE [master];
CREATE LOGIN datadog WITH PASSWORD = '<PASSWORD>';
GO
--Set context to msdb database and create datadog user
USE [msdb];
CREATE USER datadog FOR LOGIN datadog;
-- If not using either of Log Shipping Monitoring (available in Agent v7.50+), comment out the next line:
GRANT SELECT ON dbo.log_shipping_monitor_primary to datadog;
GRANT SELECT ON dbo.log_shipping_monitor_secondary to datadog;
-- If not using SQL Server Agent Monitoring (available in Agent v7.57+), comment out the next three lines:
GRANT SELECT ON dbo.sysjobs to datadog;
GRANT SELECT ON dbo.sysjobhistory TO datadog;
GRANT SELECT ON dbo.sysjobactivity to datadog;
GO
--Switch back to master and grant datadog user server permissions
USE [master];
GRANT VIEW SERVER STATE to datadog;
GRANT VIEW ANY DEFINITION to datadog;
GO

추가 애플리케이션 데이터베이스마다 datadog 사용자를 생성하세요:

USE [database_name];
CREATE USER datadog FOR LOGIN datadog;

RDS는 CONNECT ANY DATABASE 부여를 허용하지 않으므로 이 단계가 필요해요. Datadog Agent는 데이터베이스별 파일 I/O 통계를 수집하려면 각 데이터베이스에 연결해야 해요.

비밀번호 안전하게 보관

Vault 같은 시크릿 관리 소프트웨어로 비밀번호를 보관하세요. 그러면 Agent 설정 파일에서 ENC[<SECRET_NAME>] 형식으로 참조할 수 있어요. 예를 들어 ENC[datadog_user_database_password]처럼요. 자세한 내용은 Secrets Management를 참고해요.

이 페이지의 예제는 비밀번호가 저장된 시크릿 이름으로 datadog_user_database_password를 사용해요. 비밀번호를 평문으로도 참조할 수 있지만 권장하지 않아요.

Agent 설치

AWS는 직접 호스트 접근을 허용하지 않으므로 Datadog Agent는 SQL Server 호스트와 통신할 수 있는 별도 호스트에 설치해야 해요. Agent 설치 및 실행 옵션은 여러 가지가 있어요.

{% tab title="Windows Host" %} 참고: 클라우드 호스팅 인스턴스를 사용하는 AlwaysOn 사용자는 원격 인스턴스에 Agent를 설치하고 각 개별 레플리카에 연결하는 것을 권장해요. Agent가 연결된 각 레플리카에서 관련 가용성 그룹의 텔레메트리가 수집됩니다. 대체 방법으로 Agent를 별도 서버에 설치하고 리스너 엔드포인트를 통해 클러스터에 연결할 수도 있어요.

SQL Server 텔레메트리 수집을 시작하려면 Datadog Agent를 설치한 다음 C:\ProgramData\Datadog\conf.d\sqlserver.d\conf.yaml에 SQL Server Agent 설정 파일을 생성하세요. 사용 가능한 모든 설정 옵션은 샘플 설정 파일을 참고해요.

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 instance endpoint, configure the Datadog AWS integration to pull additional cloud data such as CPU, Memory, etc.
    aws:
      instance_endpoint: '<INSTANCE_ENDPOINT>'

Windows 인증을 사용하려면 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에서 더 이상 사용하지 않는(deprecated) 것으로 간주하므로 사용하면 안 돼요.

ODBC

권장 ODBC 드라이버는 Microsoft ODBC Driver예요. Agent 7.51부터 Linux Agent에 ODBC Driver 18 for SQL Server가 기본적으로 포함돼요. Windows라면 Agent가 실행 중인 호스트에 드라이버가 설치되어 있는지 확인하세요.

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

모든 Agent 설정이 완료되면 Datadog Agent를 재시작하세요.

검증

Agent의 status 하위 명령을 실행하고 Checks 섹션에서 sqlserver를 찾아보세요. Datadog의 Databases 페이지로 이동해서 시작하세요. {% /tab %}

{% tab title="Linux Host" %} 참고: 클라우드 호스팅 인스턴스를 사용하는 AlwaysOn 사용자는 원격 인스턴스에 Agent를 설치하고 각 개별 레플리카에 연결하는 것을 권장해요. Agent가 연결된 각 레플리카에서 관련 가용성 그룹의 텔레메트리가 수집됩니다. 대체 방법으로 Agent를 별도 서버에 설치하고 리스너 엔드포인트를 통해 클러스터에 연결할 수도 있어요.

SQL Server 텔레메트리 수집을 시작하려면 먼저 Datadog Agent를 설치하세요.

Linux에서는 ODBC SQL Server 드라이버도 설치해야 해요. 예를 들어 Microsoft ODBC driver처럼요. 설치 후 odbc.ini와 odbcinst.ini 파일을 /opt/datadog-agent/embedded/etc 폴더로 복사하세요.

odbc 커넥터를 사용하고 odbcinst.ini 파일에 표시된 대로 적절한 드라이버를 지정하세요.

SQL Server Agent 설정 파일 /etc/datadog-agent/conf.d/sqlserver.d/conf.yaml을 생성하세요. 사용 가능한 모든 설정 옵션은 샘플 설정 파일을 참고해요.

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 instance endpoint, configure the Datadog AWS integration to pull additional cloud data such as CPU, Memory, etc.
    aws:
      instance_endpoint: '<INSTANCE_ENDPOINT>'

service와 env 태그를 사용해 공통 태그 구성 체계로 데이터베이스 텔레메트리를 다른 텔레메트리와 연결하세요. Datadog 전체에서 이 태그들을 어떻게 사용하는지는 Unified Service Tagging을 참고해요.

모든 Agent 설정이 완료되면 Datadog Agent를 재시작하세요.

검증

Agent의 status 하위 명령을 실행하고 Checks 섹션에서 sqlserver를 찾아보세요. Datadog의 Databases 페이지로 이동해서 시작하세요. {% /tab %}

{% tab title="Docker" %} 참고: 클라우드 호스팅 인스턴스를 사용하는 AlwaysOn 사용자는 원격 인스턴스에 Agent를 설치하고 각 개별 레플리카에 연결하는 것을 권장해요. Agent가 연결된 각 레플리카에서 관련 가용성 그룹의 텔레메트리가 수집됩니다. 대체 방법으로 Agent를 별도 서버에 설치하고 리스너 엔드포인트를 통해 클러스터에 연결할 수도 있어요.

Docker 컨테이너에서 실행 중인 Database Monitoring Agent를 설정하려면 Autodiscovery 통합 템플릿을 Agent 컨테이너의 Docker 라벨로 설정하세요.

참고: 라벨 Autodiscovery가 동작하려면 Agent가 Docker 소켓에 읽기 권한이 있어야 해요.

값은 계정과 환경에 맞게 바꾸세요. 사용 가능한 모든 설정 옵션은 샘플 설정 파일을 참고해요.

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>"
    ],
    "aws": {
      "instance_endpoint": "<INSTANCE_ENDPOINT>"
    }
  }]' \
  registry.datadoghq.com/agent:${DD_AGENT_VERSION}

service와 env 태그를 사용해 공통 태그 구성 체계로 데이터베이스 텔레메트리를 다른 텔레메트리와 연결하세요. Datadog 전체에서 이 태그들을 어떻게 사용하는지는 Unified Service Tagging을 참고해요.

검증

Agent의 status 하위 명령을 실행하고 Checks 섹션에서 sqlserver를 찾아보세요. 또는 Datadog의 Databases 페이지로 이동해서 시작하세요. {% /tab %}

{% tab title="Kubernetes" %} 참고: 클라우드 호스팅 인스턴스를 사용하는 AlwaysOn 사용자는 원격 인스턴스에 Agent를 설치하고 각 개별 레플리카에 연결하는 것을 권장해요. Agent가 연결된 각 레플리카에서 관련 가용성 그룹의 텔레메트리가 수집됩니다. 대체 방법으로 Agent를 별도 서버에 설치하고 리스너 엔드포인트를 통해 클러스터에 연결할 수도 있어요.

Kubernetes 클러스터를 운영 중이라면 Datadog Cluster Agent를 사용해 Database Monitoring을 활성화하세요. 클러스터 체크가 이미 활성화되어 있지 않다면 진행 전에 이 안내를 따라 활성화하세요.

Operator

Kubernetes 및 통합의 Operator 안내를 참고하면서 아래 단계로 SQL Server 통합을 설정해요.

  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 # Required for cluster checks
                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 instance endpoint, configure the Datadog AWS integration to pull additional cloud data such as CPU, Memory, etc.
                  aws:
                    instance_endpoint: <INSTANCE_ENDPOINT>
    
  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 instance endpoint, configure the Datadog AWS integration to pull additional cloud data such as CPU, Memory, etc.
            aws:
              instance_endpoint: <INSTANCE_ENDPOINT>
    
    clusterChecksRunner:
      enabled: true
    
  3. 커맨드 라인에서 위 설정 파일로 Agent를 배포하세요:

    helm install datadog-agent -f datadog-values.yaml datadog/datadog
    

{% alert level="info" %} Windows라면 helm install 명령에 --set targetSystem=windows를 추가하세요. {% /alert %}

마운트된 파일로 설정

마운트된 설정 파일로 클러스터 체크를 설정하려면, 설정 파일을 Cluster Agent 컨테이너의 /conf.d/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 instance endpoint, configure the Datadog AWS integration to pull additional cloud data such as CPU, Memory, etc.
    aws:
      instance_endpoint: <INSTANCE_ENDPOINT>

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>"],
          "aws": {
            "instance_endpoint": "<INSTANCE_ENDPOINT>"
          }
        }
      ]
spec:
  ports:
  - port: 1433
    protocol: TCP
    targetPort: 1433
    name: sqlserver

deployment_type과 name 필드 설정에 대한 추가 정보는 SQL Server 통합 스펙을 참고해요.

Cluster Agent가 이 설정을 자동으로 등록하고 SQL Server 체크를 실행하기 시작해요.

datadog 사용자의 비밀번호를 평문으로 노출하지 않으려면 Agent의 시크릿 관리 패키지를 사용하고 ENC[] 구문으로 비밀번호를 선언하세요. {% /tab %}

예제 Agent 설정

Linux에서 ODBC 드라이버로 DSN 연결

  1. odbc.ini와 odbcinst.ini 파일을 찾으세요. 기본적으로 ODBC를 설치할 때 /etc 디렉토리에 배치돼요.

  2. odbc.ini와 odbcinst.ini 파일을 /opt/datadog-agent/embedded/etc 폴더로 복사하세요.

  3. DSN 설정을 다음과 같이 구성하세요:

odbcinst.ini는 섹션 헤더 한 개와 ODBC 드라이버 위치를 제공해야 해요.

예:

[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는 섹션 헤더와 odbcinst.ini와 일치하는 Driver 경로를 제공해야 해요.

예:

[datadog]
Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.3.so.2.1
  1. DSN 정보로 /etc/datadog-agent/conf.d/sqlserver.d/conf.yaml 파일을 업데이트하세요.

예:

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
  1. Agent를 재시작하세요.

AlwaysOn 사용

AlwaysOn 사용자라면 Agent를 각 레플리카 서버에 설치하고 각 레플리카에 직접 연결하세요. 각 개별 레플리카에서 전체 AlwaysOn 텔레메트리가 수집되고, 각 서버의 호스트 기반 텔레메트리(CPU, 디스크, 메모리 등)도 함께 수집돼요.

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

SQL Server Agent 작업 모니터링

{% alert level="info" %} SQL Server Agent 작업 모니터링을 활성화하려면 Datadog Agent가 [msdb] 데이터베이스에 접근할 수 있어야 해요. {% /alert %}

{% alert level="danger" %} SQL Server Agent 작업 모니터링은 Azure SQL Database에서 사용할 수 없어요. {% /alert %}

SQL Server Agent 작업 모니터링은 SQL Server 2016 이상 버전에서 지원돼요. Agent v7.57부터 Datadog Agent가 SQL Server Agent 작업 메트릭과 기록을 수집할 수 있어요. 이 기능을 활성화하려면 SQL Server 통합 설정 파일의 agent_jobs 섹션에서 enabled를 true로 설정하세요. collection_interval과 history_row_limit 필드는 선택 사항이에요.

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

스키마 수집

{% alert level="danger" %} SQL Server 스키마 수집에는 Datadog Agent v7.56+와 SQL Server 2017 이상이 필요해요. {% /alert %}

이 기능을 활성화하려면 collect_schemas 옵션을 사용해요. 스키마는 Agent가 CONNECT 접근 권한이 있는 데이터베이스에서 수집돼요.

{% alert level="info" %} RDS 인스턴스에서 스키마 정보를 수집하려면 datadog 사용자에게 인스턴스의 각 데이터베이스에 대한 명시적 CONNECT 접근 권한을 부여해야 해요. 자세한 내용은 Agent 접근 권한 부여를 참고해요. {% /alert %}

각 논리적 데이터베이스를 지정하지 않으려면 database_autodiscovery 옵션을 사용해요. 자세한 내용은 sqlserver.d/conf.yaml 샘플을 참고해요.

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

참고: Agent v7.68 이하에서는 collect_schemas 대신 schemas_collection을 사용하세요.

하나의 Agent가 여러 호스트에 연결

단일 Agent 호스트가 여러 원격 데이터베이스 인스턴스에 연결하도록 설정하는 건 흔한 일이에요 (DBM의 Agent 설치 아키텍처 참조). 여러 호스트에 연결하려면 SQL Server 통합 설정에서 호스트마다 항목을 만들어요.

{% alert level="info" %} Datadog는 하나의 Agent로 최대 30개의 데이터베이스 인스턴스를 모니터링할 것을 권장해요. 벤치마크에 따르면 t4g.medium EC2 인스턴스(2 CPU, 4GB RAM)에서 실행 중인 Agent 하나가 RDS db.t3.medium 인스턴스(2 CPU, 4GB RAM) 30개를 성공적으로 모니터링할 수 있어요. {% /alert %}

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'
    [...]

커스텀 쿼리 실행

커스텀 메트릭을 수집하려면 custom_queries 옵션을 사용해요. 자세한 내용은 sqlserver.d/conf.yaml 샘플을 참고해요.

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'

원격 프록시를 통한 호스트 연결

Agent가 원격 프록시를 통해 데이터베이스 호스트에 연결해야 한다면 모든 텔레메트리의 호스트네임이 데이터베이스 인스턴스가 아닌 프록시로 태그돼요. reported_hostname 옵션으로 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

포트 자동 발견

SQL Server Browser Service, Named Instances, 기타 서비스는 포트 번호를 자동으로 감지할 수 있어요. 연결 문자열에 포트 번호를 하드코딩하는 대신 이 기능을 사용할 수 있어요. 이 서비스 중 하나와 함께 Agent를 사용하려면 port 필드를 0으로 설정하세요.

예를 들어 Named Instance 설정:

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

RDS 통합 설치

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

더 알아보기 (Learn more)

추가로 도움이 되는 문서, 링크, 아티클: