Skip to main content
The 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

query-exporter [OPTIONS]

Options

--config
path
default:"config.yaml"
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:
query-exporter --config /path/to/config.yaml
query-exporter --config base.yaml --config overrides.yaml
--check-only
boolean
default:"false"
Only check configuration validity, don’t run the exporter. Useful for validating configuration files before deployment.Environment variable: QE_CHECK_ONLYExample:
query-exporter --check-only
-H, --host
string
default:"localhost"
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:
query-exporter --host 0.0.0.0
query-exporter -H 127.0.0.1 -H ::1
-p, --port
integer
default:"9560"
Port to run the webserver on.Environment variable: QE_PORTExample:
query-exporter --port 8080
query-exporter -p 9560
--metrics-path
string
default:"/metrics"
Path under which Prometheus metrics are exposed.Environment variable: QE_METRICS_PATHExample:
query-exporter --metrics-path /custom/metrics
-L, --log-level
string
default:"info"
Minimum level for log messages. Must be one of: critical, error, warning, info, debug.Environment variable: QE_LOG_LEVELExample:
query-exporter --log-level debug
query-exporter -L warning
--log-format
string
default:"plain"
Log output format. Must be one of: plain, json.Environment variable: QE_LOG_FORMATExample:
query-exporter --log-format json
--process-stats
boolean
default:"false"
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:
query-exporter --process-stats
--ssl-private-key
path
Full path to the SSL/TLS private key file. Required for HTTPS support along with --ssl-public-key.Environment variable: QE_SSL_PRIVATE_KEYExample:
query-exporter --ssl-private-key /path/to/private.key --ssl-public-key /path/to/public.crt
--ssl-public-key
path
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:
query-exporter --ssl-public-key /path/to/public.crt --ssl-private-key /path/to/private.key
--ssl-ca
path
Full path to the SSL/TLS certificate authority (CA) file. Optional, used for client certificate verification.Environment variable: QE_SSL_CAExample:
query-exporter --ssl-ca /path/to/ca.crt

Quick Reference Table

Command-line optionEnvironment variableDefaultDescription
-H, --hostQE_HOSTlocalhostHost addresses to bind. Multiple values can be provided.
-p, --portQE_PORT9560Port to run the webserver on.
--metrics-pathQE_METRICS_PATH/metricsPath under which metrics are exposed.
-L, --log-levelQE_LOG_LEVELinfoMinimum level for log messages level.
--log-formatQE_LOG_FORMATplainLog output format. One of plain, json.
--process-statsQE_PROCESS_STATSfalseInclude process stats in metrics.
--ssl-private-keyQE_SSL_PRIVATE_KEYFull path to the SSL private key.
--ssl-public-keyQE_SSL_PUBLIC_KEYFull path to the SSL public key.
--ssl-caQE_SSL_CAFull path to the SSL certificate authority (CA).
--check-onlyQE_CHECK_ONLYfalseOnly check configuration, don’t run the exporter.
--configQE_CONFIGconfig.yamlConfiguration files. Multiple values can be provided.

Examples

Basic Usage

# Run with default config.yaml in current directory
query-exporter

# Run with custom configuration file
query-exporter --config /etc/query-exporter/config.yaml

# Run with multiple configuration files (merged)
query-exporter --config base.yaml --config prod-overrides.yaml

Network Configuration

# Bind to all interfaces on custom port
query-exporter --host 0.0.0.0 --port 8080

# Custom metrics path
query-exporter --metrics-path /prometheus/metrics

SSL/TLS Configuration

# Run with HTTPS
query-exporter \
  --ssl-private-key /etc/ssl/private/server.key \
  --ssl-public-key /etc/ssl/certs/server.crt \
  --ssl-ca /etc/ssl/certs/ca.crt

Logging Configuration

# Debug logging in JSON format
query-exporter --log-level debug --log-format json

# Warning level logging only
query-exporter -L warning

Configuration Validation

# Validate configuration without starting the exporter
query-exporter --config config.yaml --check-only

Monitoring Configuration

# Include process statistics in metrics
query-exporter --process-stats

Build docs developers (and LLMs) love