How to Collect Database Data¶
Configure the appropriate database collector in DataKit to send database instance and performance data to your workspace, then view it under Infrastructure > Database.
1. Prepare DataKit¶
- Install DataKit on a host that can access the target database, using the installation command from the target workspace. If DataKit is already installed, confirm that it reports data to that workspace.
- Ensure that the DataKit host can connect to the database address and port. Prepare the collection account, permissions, and dependencies described in the corresponding collector guide.
- Older collectors may not provide all data used by the current Database page. Check the version requirements in the corresponding collector guide and upgrade as needed.
2. Select and Configure a Collector¶
Open the guide for your database type and complete its prerequisites and collector configuration:
| Database | Collector Configuration | Query, Session, and Execution Plan Collection |
|---|---|---|
| MySQL | MySQL Configuration | Enable DBM, configure performance_schema, collection permissions, and the required subfeatures. |
| PostgreSQL | PostgreSQL Configuration | Follow Database Performance Metrics Collection to configure extensions, permissions, and the required DBM subfeatures. |
| Oracle | Oracle Configuration | Enable DBM and configure query metrics, activity queries, and execution plans as needed. |
| SQL Server | SQL Server Configuration | Enable DBM and configure query metrics, activity queries, and execution plans as needed. |
| MongoDB | MongoDB Configuration | Enable DBM. Execution plans must be enabled separately, with Activity or Slow Operations enabled as a sampling source. |
| Redis | Redis Configuration | Database Explorer only. |
Under conf.d/samples in the DataKit installation directory, copy the corresponding <collector>.conf.sample to <collector>.conf. Follow the guide to configure the database connection address, collection account, password, and other settings. For container deployments, use the Kubernetes configuration in the corresponding guide.
Configuring basic metrics collection does not automatically enable query, session, or execution plan collection. Complete the corresponding DBM configuration in the table when you need these data.
3. Restart and Verify Collection¶
- Save the configuration and restart DataKit as described in DataKit Service Management.
- Check the collector in DataKit Monitor. If errors occur, use the DataKit logs to check connectivity, permissions, and configuration.
- In the target workspace, go to Infrastructure > Database > Explorer, select the database type, and confirm that the instance appears. Open the instance details to view the collected data.
- To analyze SQL across instances, open Query Analysis. Execution plans are available after the corresponding collection features are enabled and queries meeting the sampling conditions occur.
Troubleshooting¶
| Symptom | What to Check |
|---|---|
| No database instances in Explorer | Check the workspace receiving DataKit data, whether the collector is enabled, database connectivity, account permissions, and the collector version. |
| An instance appears, but query or session data is missing | Check the DBM switch, subfeatures, database extensions, and permissions. Confirm that query activity meeting the collection conditions occurred within the selected time range. |
| Execution plans are missing | Check the collector's execution plan settings, permissions, and sampling conditions. MongoDB also requires execution plan collection and at least one sampling source to be enabled. |