Skip to content

StefanKurek/snowflake-prometheus-exporter

 
 

Repository files navigation

snowflake-prometheus-exporter

Exports Snowflake warehouse, database, table, and replication statistics for a Snowflake account via HTTP for Prometheus consumption.

Configuration

Command line flags

The exporter may be configured through its command line flags:

  -h, --help                 Show context-sensitive help (also try --help-long and --help-man).
      --web.listen-address=:9975 ...
                             Addresses on which to expose metrics and web interface. Repeatable for multiple addresses.
      --web.telemetry-path="/metrics"
                             Path under which to expose metrics.
      --account=ACCOUNT      The account to collect metrics for.
      --username=USERNAME    The username for the user used when querying metrics.
      --password=PASSWORD    The password for the user used when querying metrics.
      --private-key-path     The path to the user's RSA private key file.
      --private-key-password The password for the user's RSA private key.
      --role="ACCOUNTADMIN"  The role to use when querying metrics.
      --warehouse=WAREHOUSE  The warehouse to use when querying metrics.
      --version              Show application version.
      --log.level=info       Only log messages with the given severity or above. One of: [debug, info, warn, error]
      --log.format=logfmt    Output format of log messages. One of: [logfmt, json]

Example usage:

./snowflake-exporter --account=XXXXXXX-YYYYYYY --username=USERNAME --password=PASSWORD --warehouse=WAREHOUSE --role=ACCOUNTADMIN

Example usage (with private key):

./snowflake-exporter --account=XXXXXXX-YYYYYYY --username=USERNAME --private-key-path=./PRIVATE_KEY.p8 --warehouse=WAREHOUSE --role=ACCOUNTADMIN

If both password and private key file are specified, the private key takes precedence.

Environment Variables

Alternatively, the exporter may be configured using environment variables:

Name Description
SNOWFLAKE_EXPORTER_ACCOUNT The account to collect metrics for.
SNOWFLAKE_EXPORTER_USERNAME The username for the user used when querying metrics.
SNOWFLAKE_EXPORTER_PASSWORD The password for the user used when querying metrics.
SNOWFLAKE_EXPORTER_PRIVATE_KEY_PATH The path to the user's RSA private key file.
SNOWFLAKE_EXPORTER_PRIVATE_KEY_PASSWORD The password for the user's RSA private key (not required for unencrypted keys).
SNOWFLAKE_EXPORTER_ROLE The role to use when querying metrics.
SNOWFLAKE_EXPORTER_WAREHOUSE The warehouse to use when querying metrics.
SNOWFLAKE_EXPORTER_WEB_TELEMETRY_PATH Path under which to expose metrics.

Example usage:

SNOWFLAKE_EXPORTER_ACCOUNT=XXXXXXX-YYYYYYY \
SNOWFLAKE_EXPORTER_USERNAME=USERNAME \
SNOWFLAKE_EXPORTER_PASSWORD=PASSWORD \
SNOWFLAKE_EXPORTER_ROLE=ACCOUNTADMIN \
SNOWFLAKE_EXPORTER_WAREHOUSE=WAREHOUSE \
./snowflake-exporter

Example usage (with private key):

SNOWFLAKE_EXPORTER_ACCOUNT=XXXXXXX-YYYYYYY \
SNOWFLAKE_EXPORTER_USERNAME=USERNAME \
SNOWFLAKE_EXPORTER_PRIVATE_KEY_PATH=./PRIVATE_KEY.p8 \
SNOWFLAKE_EXPORTER_ROLE=ACCOUNTADMIN \
SNOWFLAKE_EXPORTER_WAREHOUSE=WAREHOUSE \
./snowflake-exporter

RSA Key-Pair Authentication

The exporter supports RSA authentication in place of a password. Follow this guide to configure key-pair authentication in your Snowflake environment.

Note: The exporter supports both encrypted and unencrypted private keys. Both example usages below are for encrypted keys. For accurate example usages for environments with an unencrypted private key, remove the --private-key-password flag or SNOWFLAKE_EXPORTER_PRIVATE_KEY_PASSWORD variable respectively.

Example usage (flags):

./snowflake-exporter --account=XXXXXXX-YYYYYYY --username=USERNAME --private-key-path=/PATH/TO/rsa_key.p8 --private-key-password=PASSWORD --warehouse=WAREHOUSE --role=ACCOUNTADMIN

Example usage (environment vars):

SNOWFLAKE_EXPORTER_ACCOUNT=XXXXXXX-YYYYYYY \
SNOWFLAKE_EXPORTER_USERNAME=USERNAME \
SNOWFLAKE_EXPORTER_PRIVATE_KEY_PATH=/PATH/TO/rsa_key.p8 \
SNOWFLAKE_EXPORTER_PRIVATE_KEY_PASSWORD=RSAPASSWORD \
SNOWFLAKE_EXPORTER_ROLE=ACCOUNTADMIN \
SNOWFLAKE_EXPORTER_WAREHOUSE=WAREHOUSE \
./snowflake-exporter

About

A golang based prometheus metrics exporter for Snowflake.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jsonnet 50.5%
  • Go 48.1%
  • Makefile 1.1%
  • Dockerfile 0.3%