QE_ prefix followed by the option name in uppercase.
Environment Variable Prefix
All query-exporter environment variables use theQE_ prefix. This prefix is defined in the source code:
Configuration File Loading
Path to the dotenv file where environment variables can be defined. This is particularly useful when running query-exporter in Docker or other containerized environments.Note: This environment variable does not have a command-line equivalent.Example:
Available Environment Variables
Core Configuration
Configuration file path(s). Multiple files can be specified by providing comma-separated values or setting the variable multiple times in the environment.Command-line equivalent:
--configExample:Only check configuration validity without running the exporter.Command-line equivalent:
--check-onlyExample:Network Configuration
Host address(es) to bind the webserver. Multiple hosts can be specified.Command-line equivalent:
-H, --hostExample:Port to run the webserver on.Command-line equivalent:
-p, --portExample:Path under which Prometheus metrics are exposed.Command-line equivalent:
--metrics-pathExample:Logging Configuration
Minimum level for log messages. Valid values:
critical, error, warning, info, debug.Command-line equivalent: -L, --log-levelExample:Log output format. Valid values:
plain, json.Command-line equivalent: --log-formatExample:Monitoring Configuration
Include process resource usage statistics in exported metrics.Command-line equivalent:
--process-statsExample:SSL/TLS Configuration
Full path to the SSL/TLS private key file.Command-line equivalent:
--ssl-private-keyExample:Full path to the SSL/TLS public key (certificate) file.Command-line equivalent:
--ssl-public-keyExample:Full path to the SSL/TLS certificate authority (CA) file.Command-line equivalent:
--ssl-caExample:Using a .env File
You can define environment variables in a.env file instead of setting them individually. By default, query-exporter looks for a .env file in the current working directory.
Example .env File
Custom .env Location
If you want to use a.env file from a different location, set the QE_DOTENV environment variable:
Docker Usage
When running query-exporter in Docker, environment variables can be passed using the-e flag or an env file:
Using -e Flag
Using —env-file
.env File in Volume
If a.env file is present in the mounted volume at /config, its content is automatically loaded:
.env file location within the container can be customized:
Environment Variable Reference
| Environment Variable | Command-line Option | Default | Description |
|---|---|---|---|
QE_HOST | -H, --host | localhost | Host addresses to bind. Multiple values can be provided. |
QE_PORT | -p, --port | 9560 | Port to run the webserver on. |
QE_METRICS_PATH | --metrics-path | /metrics | Path under which metrics are exposed. |
QE_LOG_LEVEL | -L, --log-level | info | Minimum level for log messages level. |
QE_LOG_FORMAT | --log-format | plain | Log output format. One of plain, json. |
QE_PROCESS_STATS | --process-stats | false | Include process stats in metrics. |
QE_SSL_PRIVATE_KEY | --ssl-private-key | Full path to the SSL private key. | |
QE_SSL_PUBLIC_KEY | --ssl-public-key | Full path to the SSL public key. | |
QE_SSL_CA | --ssl-ca | Full path to the SSL certificate authority (CA). | |
QE_CHECK_ONLY | --check-only | false | Only check configuration, don’t run the exporter. |
QE_CONFIG | --config | config.yaml | Configuration files. Multiple values can be provided. |
QE_DOTENV | (none) | $PWD/.env | Path for the dotenv file where environment variables can be provided. |
Precedence
Configuration values are applied in the following order (later values override earlier ones):- Default values (defined in code)
- Environment variables from
.envfile (if exists) - Environment variables from shell
- Command-line options
Related
- Command-line Options - Complete command-line reference
- Configuration - Complete configuration file reference