Configuring
To get started with configuring your data handlers, follow the steps below. This will ensure that your data sources are properly defined and accessible via the expected routes.
Step 1: Copy the Example Configuration
Begin by copying the example configuration file to create your working configuration:
cp example-config.ini config.ini
Step 2: Edit config.ini
to Define Data Sources
Open the config.ini
file and add your data sources. Each section defines a separate source and its specific options. For example:
[example_mysql]
source = mysql.example.com
port = 3306
type = mysql
identifier = mysql-endpoint
username = dbuser
password = secret
default_db = mydatabase
query = SELECT id, name, stat1, stat2, stat3 FROM example_table
Important:
The identifier
field is crucial. It forms part of the URL used to access the metric, for example:
http://daft-server/mysql-endpoint/<exporter>
This makes it the primary reference for routing and retrieving the correct dataset.
Key Configuration Options
Option | Description |
---|---|
source | The database host, API endpoint, or file path to the data source. |
port | The connection port for the source. |
type | The type of data handler/helper to use (e.g., mysql , mssql , csv , etc.). |
identifier | Unique identifier for URL routing. This is the most critical field as it determines the endpoint. |
username / password | Credentials for authentication, if required. |
default_db | The default database to use for SQL data sources. |
query | The SQL query or command to extract the relevant data. |
Additional Options for Specific Data Handlers
Depending on the data handler selected in the type
field, you may have access to additional configuration options specific to that handler.
For example:
- MySQL / MSSQL: Options like
charset
,timeout
, or SSL-related parameters. - CSV: You might specify
delimiter
,encoding
, or whether toheader
map column names. - API / HTTP: You could define headers, authentication tokens, or query parameters.
Always refer to the handler-specific documentation for the full list of supported options.
Notes
- Ensure that your
identifier
values are unique across all sources to avoid conflicts. - Comment out or remove any unused configurations to keep the file clean and maintainable.
- Test each configuration individually to verify successful data retrieval before moving to production.