query-exporter command accepts various options to configure its behavior. Options can be specified via command-line flags, environment variables, or a .env file.
Command Syntax
Options
Configuration file path. Can be specified multiple times to provide partial configuration files. The resulting configuration will be the merge of the content of each top-level section (
databases, metrics, queries).Environment variable: QE_CONFIGExample:Only check configuration validity, don’t run the exporter. Useful for validating configuration files before deployment.Environment variable:
QE_CHECK_ONLYExample:Host address(es) to bind the webserver. Multiple values can be provided. If the hostname resolves to both IPv4 and IPv6 addresses, the exporter will bind on both.Environment variable:
QE_HOSTExample:Port to run the webserver on.Environment variable:
QE_PORTExample:Path under which Prometheus metrics are exposed.Environment variable:
QE_METRICS_PATHExample:Minimum level for log messages. Must be one of:
critical, error, warning, info, debug.Environment variable: QE_LOG_LEVELExample:Log output format. Must be one of:
plain, json.Environment variable: QE_LOG_FORMATExample:Include process resource usage statistics in the exported metrics. When enabled, adds metrics about CPU, memory, and other process-level statistics.Environment variable:
QE_PROCESS_STATSExample:Full path to the SSL/TLS private key file. Required for HTTPS support along with
--ssl-public-key.Environment variable: QE_SSL_PRIVATE_KEYExample:Full path to the SSL/TLS public key (certificate) file. Required for HTTPS support along with
--ssl-private-key.Environment variable: QE_SSL_PUBLIC_KEYExample:Full path to the SSL/TLS certificate authority (CA) file. Optional, used for client certificate verification.Environment variable:
QE_SSL_CAExample:Quick Reference Table
| Command-line option | Environment variable | Default | Description |
|---|---|---|---|
-H, --host | QE_HOST | localhost | Host addresses to bind. Multiple values can be provided. |
-p, --port | QE_PORT | 9560 | Port to run the webserver on. |
--metrics-path | QE_METRICS_PATH | /metrics | Path under which metrics are exposed. |
-L, --log-level | QE_LOG_LEVEL | info | Minimum level for log messages level. |
--log-format | QE_LOG_FORMAT | plain | Log output format. One of plain, json. |
--process-stats | QE_PROCESS_STATS | false | Include process stats in metrics. |
--ssl-private-key | QE_SSL_PRIVATE_KEY | Full path to the SSL private key. | |
--ssl-public-key | QE_SSL_PUBLIC_KEY | Full path to the SSL public key. | |
--ssl-ca | QE_SSL_CA | Full path to the SSL certificate authority (CA). | |
--check-only | QE_CHECK_ONLY | false | Only check configuration, don’t run the exporter. |
--config | QE_CONFIG | config.yaml | Configuration files. Multiple values can be provided. |
Examples
Basic Usage
Network Configuration
SSL/TLS Configuration
Logging Configuration
Configuration Validation
Monitoring Configuration
Related
- Environment Variables - Configure query-exporter using environment variables
- Configuration - Complete configuration file reference