Connect EMQX Tables to Grafana
Grafana is a popular open-source platform for monitoring and visualizing time-series data. You can connect EMQX Tables to Grafana using the MySQL data source and create dashboards to explore your data.
Step 1: Add EMQX Tables as a Data Source
In Grafana, go to Connections > Data sources and click Add data source.
Choose MySQL as the data source type.
Configure the connection:
You can find these credentials on your EMQX Tables Deployment Overview page in the Console.
- Host:
{YOUR_EMQX_TABLES_PUBLIC_HOST} - Port:
4002 - Database:
{YOUR_EMQX_TABLES_DB_NAME} - Username:
{YOUR_EMQX_TABLES_USERNAME} - Password:
{YOUR_EMQX_TABLES_PASSWORD}
- Host:
Click Save & Test to validate the connection.
Step 2: Create Dashboards
Note
Use the raw SQL editor only. The SQL query builder in Grafana is not compatible with EMQX Tables due to timestamp type differences.
Open a new or existing dashboard.
Add a panel and switch to the Code mode in the Query section.
Write your SQL query to fetch data from EMQX Tables. For example:
sqlSELECT timestamp_column AS time, temperature AS value, location AS metric FROM sensor_data WHERE $__timeFilter(timestamp_column)Click Apply to save and visualize the panel.
Reference
For more details on configuring MySQL data sources in Grafana, see the official documentation.