Skip to content

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

  1. In Grafana, go to Connections > Data sources and click Add data source.

  2. Choose MySQL as the data source type.

  3. 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}
  4. 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.

  1. Open a new or existing dashboard.

  2. Add a panel and switch to the Code mode in the Query section.

  3. Write your SQL query to fetch data from EMQX Tables. For example:

    sql
    SELECT
      timestamp_column AS time,
      temperature AS value,
      location AS metric
    FROM sensor_data
    WHERE $__timeFilter(timestamp_column)
  4. Click Apply to save and visualize the panel.

Reference

For more details on configuring MySQL data sources in Grafana, see the official documentation.