Skip to content

Environment Variables ​

Here is a list of available environment variables that can be used to configure SQL Exporter:

Environment VariableDefaultDescription
SQLEXPORTER_CONFIGsql_exporter.ymlfile path to the configuration file
SQLEXPORTER_COLLECTOR_FILESglob pattern(s) for collector definition files, semicolon-separated
Environment VariableDefaultDescription
SQLEXPORTER_GLOBAL_MIN_INTERVAL0sminimum interval between query executions
SQLEXPORTER_GLOBAL_SCRAPE_TIMEOUT10sper-scrape timeout, global
SQLEXPORTER_GLOBAL_SCRAPE_TIMEOUT_OFFSET500msoffset to subtract from timeout in seconds
SQLEXPORTER_GLOBAL_SCRAPE_ERROR_DROP_INTERVAL0sinterval to drop scrape errors from the error counter
SQLEXPORTER_GLOBAL_PING_INTERVAL0sinterval between database pings
SQLEXPORTER_GLOBAL_MAX_CONNECTIONS3maximum number of open connections to any one target
SQLEXPORTER_GLOBAL_MAX_IDLE_CONNECTIONS3maximum number of idle connections to any one target
SQLEXPORTER_GLOBAL_MAX_CONNECTION_LIFETIME0maximum amount of time a connection may be reused to any one target
SQLEXPORTER_GLOBAL_WARMUP_DELAY0sdelay between executing collectors during cache population at startup
SQLEXPORTER_GLOBAL_ENABLE_QUERY_METRICSfalseexpose per-query duration and row count metrics
Environment VariableDefaultDescription
SQLEXPORTER_TARGET_NAME(Optional) Target name, generates up and scrape_duration_seconds additional metrics)
SQLEXPORTER_TARGET_DSNURL-format connection string for the target database
SQLEXPORTER_TARGET_COLLECTORSCollector names to execute on the target, should be semicolon-separated
SQLEXPORTER_TARGET_ENABLE_PINGtrueping the database before executing collectors