Snowflake

Supported OS Mac OS Windows

통합 버전5.6.0

개요

이 검사는 Datadog Agent를 통해 Snowflake를 모니터링합니다. Snowflake는 SaaS 분석 데이터 웨어하우스이며 완전히 클라우드 인프라스트럭처에서 실행됩니다. 이 통합은 크레딧 사용량, 청구, 저장용량, 쿼리 메트릭 등을 모니터링합니다.

참고: 메트릭은 Snowflake에 대한 쿼리를 통해 수집됩니다. Datadog 통합으로 생성된 쿼리는 Snowflake에서 청구 가능합니다..

설정

호스트에서 실행되는 Agent에 대해 이 검사를 설치하고 구성하려면 아래 지침을 따르세요.

설치

Snowflake 검사는 Datadog Agent 패키지에 포함되어 있습니다.

참고: Python 2를 사용하는 Datadog Agent v6에서는 Snowflake 검사를 사용할 수 없습니다. Agent v6에서 Snowflake를 사용하려면 Datadog Agent v6에서 Python 3 사용을 참조하거나 Agent v7로 업그레이드하세요.

구성

Snowflake에서는 `SYSADMIN`과 같은 대체 역할에 권한을 부여할 것을 권장합니다. 자세히 알아보려면 ACCOUNTADMIN 역할 제어를 참고하세요.
  1. Snowflake를 모니터링하려면 Datadog 특정 역할과 사용자를 생성하세요. Snowflake에서 다음을 실행하여 ACCOUNT_USAGE 스키마에 대한 액세스 권한이 있는 커스텀 역할을 생성합니다.

    참고: 기본적으로 이 통합은 SNOWFLAKE 데이터베이스와 ACCOUNT_USAGE 스키마를 모니터링합니다. ORGANIZATION_USAGE 스키마 모니터링 방법을 알아보려면 “Collecting Organization Data"를 참조하세요. 이 데이터베이스는 기본적으로 사용 가능하며 ACCOUNTADMIN 역할 또는 ACCOUNTADMIN이 부여한 모든 역할의 사용자만 볼 수 있습니다.

    use role ACCOUNTADMIN;
    grant imported privileges on database snowflake to role SYSADMIN;
    
    use role SYSADMIN;
    

    또는 ACCOUNT_USAGE에 대한 액세스 권한이 있는 DATADOG 커스텀 역할을 생성할 수 있습니다..

    -- Snowflake 사용량을 모니터링하기 위한 새 역할을 만듭니다.
    create role DATADOG;
    
    -- SNOWFLAKE 데이터베이스에 대한 권한을 새 역할에 부여합니다.
    grant imported privileges on database SNOWFLAKE to role DATADOG;
    
    -- DATADOG 역할에 기본 웨어하우스 대한 사용 권한을 부여합니다.
    grant usage on warehouse <WAREHOUSE> to role DATADOG;
    
    -- 사용자를 생성합니다. 기존 사용자를 사용하는 경우 이 단계를 건너뜁니다.
    create user DATADOG_USER
    LOGIN_NAME = DATADOG_USER
    password = '<PASSWORD>'
    default_warehouse = <WAREHOUSE>
    default_role = DATADOG
    default_namespace = SNOWFLAKE.ACCOUNT_USAGE;
    
    -- 사용자에게 모니터 역할을 부여합니다.
    grant role DATADOG to user <USER>;
    
  2. Snowflake 성능 데이터 수집을 시작하려면 Agent 구성 디렉터리 루트에 있는 conf.d/ 폴더에서 snowflake.d/conf.yaml 파일을 편집하세요. 사용 가능한 모든 구성 옵션은 샘플 snowflake.d/conf.yaml을 참조하세요.

        ## @param account - string - required
        ## Name of your account (provided by Snowflake), including the platform and region if applicable.
        ## For more information on Snowflake account names,
        ## see https://docs.snowflake.com/en/user-guide/connecting.html#your-snowflake-account-name
        #
      - account: <ORG_NAME>-<ACCOUNT_NAME>
    
        ## @param username - string - required
        ## Login name for the user.
        #
        username: <USER>
    
        ## @param password - string - required
        ## Password for the user
        #
        password: <PASSWORD>
    
        ## @param role - string - required
        ## Name of the role to use.
        ##
        ## By default, the SNOWFLAKE database is only accessible by the ACCOUNTADMIN role. Snowflake recommends
        ## configuring a role specific for monitoring:
        ## https://docs.snowflake.com/en/sql-reference/account-usage.html#enabling-account-usage-for-other-roles
        #
        role: <ROLE>
    
        ## @param min_collection_interval - number - optional - default: 15
        ## This changes the collection interval of the check. For more information, see:
        ## https://docs.datadoghq.com/developers/write_agent_check/#collection-interval
        ##
        ## NOTE: Most Snowflake ACCOUNT_USAGE views are populated on an hourly basis,
        ## so to minimize unnecessary queries, set the `min_collection_interval` to 1 hour.
        #
        min_collection_interval: 3600
    
        # @param disable_generic_tags - boolean - optional - default: false
        # Generic tags such as `cluster` will be replaced by <integration_name>_cluster to avoid
        # getting mixed with other integration tags.
        # disable_generic_tags: true
    
    In the default `conf.yaml`, the min_collection_interval is 1 hour. Snowflake metrics are aggregated by day, you can increase the interval to reduce the number of queries.
    Note: Snowflake ACCOUNT_USAGE views have a known latency of 45 minutes to 3 hours.
  3. 에이전트를 재시작합니다.

조직 데이터 수집

기본적으로 이 통합은 ACCOUNT_USAGE 스키마를 모니터링하지만 대신 조직 수준 메트릭을 모니터링하도록 설정할 수 있습니다.

조직 메트릭을 수집하려면 통합 구성에서 스키마 필드를 ORGANIZATION_USAGE로 변경하고 min_collection_interval을 43200으로 늘립니다. 대부분의 조직 쿼리에는 최대 24시간의 지연 시간이 있으므로 이렇게 하면 Snowflake에 대한 쿼리 수가 줄어듭니다.

참고: 조직 메트릭을 모니터링하려면 user에게 ORGADMIN 역할이 있어야 합니다.

    - schema: ORGANIZATION_USAGE
      min_collection_interval: 43200

기본적으로 일부 조직 메트릭만 활성화됩니다. 사용 가능한 모든 조직 메트릭을 수집하려면 metric_groups 구성 옵션을 활용하세요.

    metric_groups:
      - snowflake.organization.warehouse
      - snowflake.organization.currency
      - snowflake.organization.credit
      - snowflake.organization.storage
      - snowflake.organization.contracts
      - snowflake.organization.balance
      - snowflake.organization.rate
      - snowflake.organization.data_transfer

또한 계정과 조직 메트릭을 동시에 모니터링할 수 있습니다.

    instances:
    - account: example-inc
      username: DATADOG_ORG_ADMIN
      password: '<PASSWORD>'
      role: SYSADMIN
      schema: ORGANIZATION_USAGE
      database: SNOWFLAKE
      min_collection_interval: 43200

    - account: example-inc
      username: DATADOG_ACCOUNT_ADMIN
      password: '<PASSWORD>'
      role: DATADOG_ADMIN
      schema: ACCOUNT_USAGE
      database: SNOWFLAKE
      min_collection_interval: 3600

여러 환경에 대한 데이터 수집

여러 Snowflake 환경에 대한 데이터를 수집하려면 각 환경을 snowflake.d/conf.yaml 파일에 인스턴스로 추가하세요. 예를 들어 이름이 DATADOG_SYSADMIN 및 이DATADOG_USER인 두 명의 사용자에 대한 데이터를 수집해야 하는 경우:

instances:
  - account: example-inc
    username: DATADOG_SYSADMIN
    password: '<PASSWORD>'
    role: SYSADMIN
    database: EXAMPLE-INC

  - account: example-inc
    username: DATADOG_USER
    password: '<PASSWORD>'
    role: DATADOG_USER
    database: EXAMPLE-INC

프록시 설정

Snowflake에서는 프록시 구성을 위한 환경 변수 설정을 권장합니다.

snowflake.d/conf.yamlinit_config에서 proxy_host, proxy_port, proxy_user, proxy_password를 설정할 수 있습니다.

참고: Snowflake는 자동으로 프록시 구성 형식을 지정하고 표준 프록시 환경 변수를 설정합니다. 이러한 변수는 Docker, ECS, Kubernetes와 같은 오케스트레이터를 포함한 통합의 모든 요청에도 영향을 미칩니다.

Snowflake 구성에 대한 프라이빗 연결

Snowflake에서 프라이빗 연결(예: AWS PrivateLink)이 활성화된 경우 account 구성 옵션을 다음과 같이 업데이트하여 Snowflake 통합을 구성할 수 있습니다.

      - account: <ACCOUNT>.<REGION_ID>.privatelink

Snowflake 커스텀 쿼리

Snowflake 통합은 커스텀 쿼리를 지원합니다. 기본적으로 통합은 공유 SNOWFLAKE 데이터베이스 및 ACCOUNT_USAGE 스키마에 연결됩니다.

다른 스키마나 데이터베이스에서 커스텀 쿼리를 실행하려면 sample snowflake.d/conf.yaml에 다른 인스턴스를 추가하고 databaseschema 옵션을 지정합니다. 사용자 및 역할이 지정된 데이터베이스 또는 스키마에 대한 액세스 권한이 있는지 확인하세요.

설정 옵션

custom_queries 옵션에는 다음과 같은 옵션이 있습니다.

옵션필수설명
쿼리실행할 SQL입니다. 간단한 구문이나 여러 줄의 스크립트일 수 있습니다. 결과의 모든 열이 평가됩니다. 여러 줄 스크립트일 경우 파이프를 사용합니다.
컬럼각 컬럼을 나타내는 목록이 왼쪽에서 오른쪽으로 순차 정렬되어 있습니다.

다음과 같은 필수 데이터 두 가지가 있습니다:
-name: metric_prefix에 추가하여 전체 메트릭 이름을 구성하는 접두사입니다. typetag으로 지정하면 해당 컬럼은 이 쿼리에서 수집한 모든 메트릭에 태그로 적용됩니다.
-type
: 제출 방법입니다(gauge, count, rate 등). tag로 설정하여 행의 각 메트릭에 이 컬럼에 있는 항목의 이름과 값(<name>:<row_value>)을 태그로 지정할 수도 있습니다.
tags아니요각 메트릭에 적용할 정적 태그 목록입니다.
참고
  • 정의된 columns의 항목 중 최소 하나 이상은 메트릭 유형(gauge, count, rate 등)이어야 합니다.
  • 열의 항목 수는 쿼리에 반환된 열 수와 동일해야 합니다.
  • 정의된 columns 항목의 순서는 쿼리에서 반환된 순서와 동일해야 합니다.
custom_queries:
  - query: select F3, F2, F1 from Table;
    columns:
      - name: f3_metric_alias
        type: gauge
      - name: f2_tagkey
        type: tag
      - name: f1_metric_alias
        type: count
    tags:
      - test:snowflake

예시

다음 예는 데이터베이스, 스키마 및 웨어하우스 이름으로 태그가 지정된 QUERY_HISTORY의 모든 쿼리를 계산하는 쿼리입니다.

select count(*), DATABASE_NAME, SCHEMA_NAME, WAREHOUSE_NAME from QUERY_HISTORY group by 2, 3, 4;
구성

instances에서 커스텀 쿼리 구성은 다음과 같습니다.

custom_queries:
  - query: select count(*), DATABASE_NAME, SCHEMA_NAME, WAREHOUSE_NAME from QUERY_HISTORY group by 2, 3, 4;
    columns:
      - name: query.total
        type: gauge
      - name: database_name
        type: tag
      - name: schema_name
        type: tag
      - name: warehouse_name
        type: tag
    tags:
      - test:snowflake
검증

결과를 확인하려면 Metrics Summary를 사용하여 메트릭을 검색합니다.

Snowflake Metric Summary

검증

Agent의 상태 하위 명령을 실행하고 Checks 섹션에서 snowflake를 찾으세요.

수집한 데이터

참고: 다음 메트릭 그룹의 메트릭만 기본적으로 활성화됩니다. snowflake.query.*, snowflake.billing.*, snowflake.storage.*, snowflake.logins.*.

다른 메트릭 그룹에서 메트릭을 수집하려면 이 통합에 대한 예제 구성 파일을 참조하세요.

메트릭

snowflake.auto_recluster.bytes_reclustered.avg
(gauge)
Average bytes reclustered.
Shown as byte
snowflake.auto_recluster.bytes_reclustered.sum
(gauge)
Total bytes reclustered.
Shown as byte
snowflake.auto_recluster.credits_used.avg
(gauge)
Average credits billed for automatic reclustering.
Shown as unit
snowflake.auto_recluster.credits_used.sum
(gauge)
Total credits billed for automatic reclustering.
Shown as unit
snowflake.auto_recluster.rows_reclustered.avg
(gauge)
Average rows reclustered.
Shown as row
snowflake.auto_recluster.rows_reclustered.sum
(gauge)
Total rows reclustered.
Shown as row
snowflake.billing.cloud_service.avg
(gauge)
The average overall credits billed per hour for cloud services.
Shown as unit
snowflake.billing.cloud_service.sum
(gauge)
The total overall credits billed for cloud services.
Shown as unit
snowflake.billing.total_credit.avg
(gauge)
The average overall of credits used per hour for the account. This is the sum of snowflake.billing.cloudservice and snowflake.billing.virtualwarehouses.
Shown as unit
snowflake.billing.total_credit.sum
(gauge)
The total overall of credits used for the account. This is the sum of snowflake.billing.cloudservice and snowflake.billing.virtualwarehouses.
Shown as unit
snowflake.billing.virtual_warehouse.avg
(gauge)
The average overall credits billed per hour for virtual warehouses.
Shown as unit
snowflake.billing.virtual_warehouse.sum
(gauge)
The sum of overall credits billed for virtual warehouses.
Shown as unit
snowflake.billing.warehouse.cloud_service.avg
(gauge)
The average credits used per hour for cloud services by warehouse.
Shown as unit
snowflake.billing.warehouse.cloud_service.sum
(gauge)
The total credits used for cloud services by warehouse.
Shown as unit
snowflake.billing.warehouse.total_credit.avg
(gauge)
The average total number of credits used per hour for the warehouse. NOTE: This value does not take into account adjustments which may be higher than your actual credit consumption.
Shown as unit
snowflake.billing.warehouse.total_credit.sum
(gauge)
The total number of credits used for the warehouse. NOTE: This value does not take into account adjustments which may be higher than your actual credit consumption.
Shown as unit
snowflake.billing.warehouse.virtual_warehouse.avg
(gauge)
The average credits used per hour by warehouse.
Shown as unit
snowflake.billing.warehouse.virtual_warehouse.sum
(gauge)
The total credits used by warehouse.
Shown as unit
snowflake.data_transfer.bytes.avg
(gauge)
Average bytes transferred.
Shown as byte
snowflake.data_transfer.bytes.sum
(gauge)
Total bytes transferred.
Shown as byte
snowflake.logins.fail.count
(count)
Total failed login attempts.
Shown as error
snowflake.logins.success.count
(count)
Total successful login attempts.
Shown as success
snowflake.logins.total
(count)
Total number of login attempts.
Shown as attempt
snowflake.organization.balance.capacity
(gauge)
The amount of capacity in currency that is available for use. This is the end of day balance.
snowflake.organization.balance.free_usage
(gauge)
The amount of free usage in currency that is available for use. This is the end of day balance
snowflake.organization.balance.on_demand_consumption
(gauge)
The amount of consumption at on demand prices that will be invoiced given that all the free usage and capacity balances have been exhausted. This is a negative value (e.g. -250) until the invoice is paid. This is the end of day balance.
snowflake.organization.balance.rollover
(gauge)
The amount of rollover balance in currency that is available for use. At the end of a contract term
snowflake.organization.contract.amount
(gauge)
The average amount for the given contract
snowflake.organization.credit.cloud_service.avg
(gauge)
The average overall credits billed for cloud services
snowflake.organization.credit.cloud_service.sum
(gauge)
The sum of credits billed for cloud services
snowflake.organization.credit.cloud_service_adjustment.avg
(gauge)
Average of credits adjusted for included cloud services.
snowflake.organization.credit.cloud_service_adjustment.sum
(gauge)
Sum of credits adjusted for included cloud services.
snowflake.organization.credit.total_credit.avg
(gauge)
The average number of overall of credits used for the organization. This is the sum of snowflake.organization.credit.cloudservice.avg and snowflake.organization.credit.virtualwarehouse.avg.
snowflake.organization.credit.total_credit.sum
(gauge)
The sum of overall of credits used for the organization. This is the sum of snowflake.organization.credit.cloudservice.sum and snowflake.organization.credit.virtualwarehouse.sum.
snowflake.organization.credit.total_credits_billed.avg
(gauge)
The average number of credits billed for the account in the day. It is the sum of snowflake.organization.credit.cloudservice.avg, snowflake.organization.credit.virtualwarehouse.avg, and snowflake.organization.credit.cloudserviceadjustment.avg.
snowflake.organization.credit.total_credits_billed.sum
(gauge)
The total number of credits billed for the account in the day. It is the sum of snowflake.organization.credit.cloudservice.sum, snowflake.organization.credit.virtualwarehouse.sum, and snowflake.organization.credit.cloudserviceadjustment.sum.
snowflake.organization.credit.virtual_warehouse.avg
(gauge)
The average credits used per day by warehouse.
snowflake.organization.credit.virtual_warehouse.sum
(gauge)
The sum of credits used by warehouse.
snowflake.organization.currency.usage
(gauge)
Sum of the total number of credits charged per day.
snowflake.organization.currency.usage_in_currency
(gauge)
Sum of the total amount charged for the day.
snowflake.organization.data_transfer.bytes_transferred
(gauge)
Number of bytes transferred during the usage date.
Shown as byte
snowflake.organization.rate.effective_rate
(gauge)
The rate after applying any applicable discounts per the contract for the organization.
snowflake.organization.storage.average_bytes
(gauge)
Number of bytes of database storage used, including data in Time Travel and Fail-safe.
Shown as byte
snowflake.organization.storage.credits
(gauge)
Sum of total number of credits used for all accounts in the organization. Sum of credits used for database storage and stages.
snowflake.organization.warehouse.cloud_service.avg
(gauge)
Average number of credits used for cloud services.
snowflake.organization.warehouse.cloud_service.sum
(gauge)
Sum of credits used for cloud services.
snowflake.organization.warehouse.total_credit.avg
(gauge)
The average total number of credits used by the warehouse. Sum of snowflake.organization.warehouse.cloudservice.avg and snowflake.organization.warehouse.totalcredit.avg
snowflake.organization.warehouse.total_credit.sum
(gauge)
The total number of credits used by the warehouse. Sum of snowflake.organization.warehouse.cloudservice.sum and snowflake.organization.warehouse.totalcredit.sum.
snowflake.organization.warehouse.virtual_warehouse.avg
(gauge)
Average number of credits used for the warehouse.
snowflake.organization.warehouse.virtual_warehouse.sum
(gauge)
Sum of number of credits used for the warehouse.
snowflake.pipe.bytes_inserted.avg
(gauge)
Average number of bytes loaded from Snowpipe.
Shown as byte
snowflake.pipe.bytes_inserted.sum
(gauge)
Total number of bytes loaded from Snowpipe.
Shown as byte
snowflake.pipe.credits_used.avg
(gauge)
Average number of credits billed for Snowpipe data loads.
Shown as unit
snowflake.pipe.credits_used.sum
(gauge)
Total number of credits billed for Snowpipe data loads.
Shown as unit
snowflake.pipe.files_inserted.avg
(gauge)
Average number of files loaded from Snowpipe.
Shown as file
snowflake.pipe.files_inserted.sum
(gauge)
Total number of files loaded from Snowpipe.
Shown as file
snowflake.query.blocked
(gauge)
Average number of queries blocked by a transaction lock.
Shown as query
snowflake.query.bytes_deleted
(gauge)
Average query bytes deleted.
Shown as byte
snowflake.query.bytes_scanned
(gauge)
Average query bytes scanned.
Shown as byte
snowflake.query.bytes_spilled.local
(gauge)
Avg volume of data spilled to local disk.
Shown as byte
snowflake.query.bytes_spilled.remote
(gauge)
Avg volume of data spilled to remote disk.
Shown as byte
snowflake.query.bytes_written
(gauge)
Average query bytes written.
Shown as byte
snowflake.query.compilation_time
(gauge)
Average query compilation time.
Shown as millisecond
snowflake.query.executed
(gauge)
The average number of queries executed.
Shown as query
snowflake.query.execution_time
(gauge)
Average query execution time.
Shown as millisecond
snowflake.query.queued_overload
(gauge)
Average number of queries queued because the warehouse was overloaded.
Shown as query
snowflake.query.queued_provision
(gauge)
Average number of queries queued because the warehouse was being provisioned.
Shown as query
snowflake.replication.bytes_transferred.avg
(gauge)
Average number of bytes transferred for database replication.
Shown as byte
snowflake.replication.bytes_transferred.sum
(gauge)
Total number of bytes transferred for database replication.
Shown as byte
snowflake.replication.credits_used.avg
(gauge)
Average number of credits used for database replication.
Shown as unit
snowflake.replication.credits_used.sum
(gauge)
Total number of credits used for database replication.
Shown as unit
snowflake.storage.database.failsafe_bytes
(gauge)
The average number of bytes of Fail-safe storage used.
Shown as byte
snowflake.storage.database.storage_bytes
(gauge)
The average number of bytes of database storage used.
Shown as byte
snowflake.storage.failsafe_bytes.total
(gauge)
The average number of bytes of data in Fail-safe.
Shown as byte
snowflake.storage.stage_bytes.total
(gauge)
The average number of bytes of stage storage used by files in all internal stages.
Shown as byte
snowflake.storage.storage_bytes.total
(gauge)
The average number of bytes of table storage used including bytes for data currently in Time Travel.
Shown as byte
snowflake.storage.table.active_bytes.avg
(gauge)
Average bytes owned by (and billed to) this table that are in the active state.
Shown as byte
snowflake.storage.table.failsafe_bytes.avg
(gauge)
Average bytes owned by (and billed to) this table that are in the Fail-safe state.
Shown as byte
snowflake.storage.table.retained_bytes.avg
(gauge)
Average bytes owned by (and billed to) this table that are retained after deletion because they are referenced by one or more clones of this table.
Shown as byte
snowflake.storage.table.time_travel_bytes.avg
(gauge)
Average bytes owned by (and billed to) this table that are in the Time Travel state.
Shown as byte

이벤트

Snowflake는 이벤트를 포함하지 않습니다.

서비스 점검

snowflake.can_connect
Returns CRITICAL if the check cannot authenticate Snowflake credentials. Returns OK otherwise.
Statuses: ok, critical

트러블슈팅

도움이 필요하신가요? Datadog 지원팀에 문의해 주세요.

참고 자료

기타 유용한 문서, 링크 및 기사: