Configuration Validation
Check Configuration Before Running
Use the--check-only flag to validate your configuration without starting the exporter:
- YAML syntax
- Configuration structure
- Database DSN format
- Query SQL syntax
- Metric definitions
- Label consistency
Common Configuration Errors
Invalid YAML Syntax
Error:- Check for proper indentation (use spaces, not tabs)
- Ensure colons are followed by spaces
- Quote strings containing special characters
- Use YAML validators online
Missing Required Fields
Error:Unknown Database References
Error:databases section:
Unknown Metric References
Error:metrics section:
Database Connection Issues
Connection Refused
Error:-
Database not running:
-
Wrong host/port:
-
Firewall blocking connection:
Authentication Failed
Error:-
Verify credentials:
-
Check environment variables:
-
URL-encode special characters:
Database Not Found
Error:-
Verify database name:
-
Check DSN:
Driver Not Found
Error:SSL/TLS Connection Issues
Error:-
Verify SSL is required:
-
Configure SSL mode:
Query Execution Issues
Query Timeout
Error:-
Increase timeout:
-
Optimize query:
- Add indexes
- Reduce data scanned
- Use WHERE clauses
- Avoid SELECT *
-
Check query performance:
Column Name Mismatch
Error:Missing Labels
Error:SQL Syntax Errors
Error:-
Test query independently:
-
Check for parameter escaping:
Parameter Issues
Error:Diagnostic Tools
Built-in Metrics
Query Exporter provides metrics to diagnose issues:database_errors
Counter of database errors:queries
Counter of query executions by status:query_latency
Histogram of query execution time:query_timestamp
Timestamp of last query execution:Log Levels
Increase log verbosity for debugging:Log Formats
Plain format (human-readable):Environment Variable Issues
Variable Not Set
Error:-
Set environment variable:
-
Use .env file:
-
Verify .env location:
Wrong Variable Type
Error:File Reference Issues
File Not Found
Error:-
Check file exists:
-
Verify relative path:
- Paths are relative to the YAML file using the
!filetag - Not relative to current directory
- Paths are relative to the YAML file using the
-
Use absolute path:
Include File Not Found
Error:Docker-Specific Issues
Config File Not Found
Error:Database Host Connectivity
Error:Performance Issues
High Memory Usage
Causes & Solutions:-
Too many concurrent queries:
-
Large result sets:
- Add LIMIT to queries
- Use aggregation instead of raw data
- Process data in database, not exporter
-
Metric series explosion:
High CPU Usage
Causes & Solutions:-
Too frequent queries:
-
Expensive queries:
- Optimize SQL queries
- Add database indexes
- Use materialized views
Slow Startup
Solution: Use--check-only to identify slow configuration:
- Slow database connections
- Large included files
- Many database definitions
Getting Help
Enable Debug Logging
Capture detailed logs:Collect Diagnostic Information
-
Version:
-
Configuration (sanitized):
-
Metrics:
-
Logs:
Report Issues
When reporting issues, include:- Query Exporter version
- Database type and version
- Sanitized configuration
- Complete error message
- Debug logs (if applicable)
- Steps to reproduce
Further Reading
- Configuration Reference for detailed options
- Database Engines for DSN format
- YAML Tags for
!envand!fileusage - Security Guide for credential management