All Products
Search
Document Center

Tablestore:Connect to Grafana

Last Updated:Oct 29, 2025

After you connect Tablestore to Grafana, use Grafana to visualize the data in Tablestore.

Prerequisites

Background information

Grafana is an open source visualization and analytics platform that supports data query and visualization for various data sources such as Prometheus, Graphite, OpenTSDB, InfluxDB, Elasticsearch, MySQL, and PostgreSQL. For more information, see the Grafana official documentation.

After you connect Tablestore to Grafana, use Grafana to generate dashboard panels based on the table data and display the data in real time.

Usage notes

Use Grafana to visualize Tablestore data in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), and Singapore.

Step 1: Install the Tablestore plug-in

Windows

  1. Download the Grafana plug-in package for Tablestore.

  2. Decompress the package and move the plug-in files to the plugins-bundled directory of your Grafana installation.

  3. Modify the Grafana configuration file.

    1. Use a text editor to open the defaults.ini configuration file in the conf directory.

    2. In the [plugins] section of the configuration file, set the allow_loading_unsigned_plugins parameter.

      allow_loading_unsigned_plugins = aliyun-tablestore-grafana-datasource
  4. In Task Manager, restart the grafana-server.exe process.

Mac/Linux

  1. Run the following command to download the Grafana plug-in package for Tablestore.

    wget https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20220527/ygdf/tablestore-grafana-plugin-1.0.0.zip
  2. Decompress the package to the Grafana plug-in directory.

    Run the command that corresponds to your Grafana installation method.

    • If you installed Grafana from a Yellowdog Updater, Modified (YUM) repository or an RPM Package Manager (RPM) package (Linux only): unzip tablestore-grafana-plugin-1.0.0.zip -d /var/lib/grafana/plugins

    • If you installed Grafana from a .zip file: unzip tablestore-grafana-plugin-1.0.0.zip -d {PATH_TO}/grafana-{VERSION}/data/plugins

      Note

      In the command, {PATH_TO}/grafana-{VERSION} specifies the installation path of Grafana, and {VERSION} specifies the version number of Grafana.

  3. Modify the Grafana configuration file.

    1. Open the configuration file.

      • If you installed Grafana from a YUM repository or an RPM package (Linux only): /etc/grafana/grafana.ini

      • If you installed Grafana from a .zip file: {PATH_TO}/grafana-{VERSION}/conf/defaults.ini

        Note

        In the path, {PATH_TO}/grafana-{VERSION} specifies the installation path of Grafana, and {VERSION} specifies the version number of Grafana.

    2. In the [plugins] section of the configuration file, set the allow_loading_unsigned_plugins parameter.

      allow_loading_unsigned_plugins = aliyun-tablestore-grafana-datasource
  4. Restart Grafana.

    1. Run the kill command to stop the Grafana process.

    2. Run the command that corresponds to your installation method to start Grafana.

      • If you installed Grafana from a YUM repository or an RPM package (Linux only): systemctl restart grafana-server

      • If you installed Grafana from a .zip file: ./bin/grafana-server web

Step 2: Configure a data source

  1. Log on to Grafana.

    1. In a browser, enter http://<x.x.x.x>:3000/ to open the Grafana logon page.

      Note

      <x.x.x.x> specifies the IP address of the server where Grafana is deployed. For example, if Grafana is installed in a Windows environment, the logon address is http://localhost:3000.

    2. Enter your Email or username and Password, and then click Log in.

      Note

      The default username and password are both admin. When you log on for the first time, you are prompted to change the password.

  2. On the Grafana home page, click the image icon in the upper-left corner.

  3. In the navigation pane on the left, choose Connections > Data sources.

  4. On the Data sources page, click + Add new data source.

    image

  5. On the Add data source page, in the Others section, click aliyun-tablestore-grafana-datasource.

  6. On the Settings page, configure the parameters as described in the following table.

    Parameter

    Example

    Description

    Name

    aliyun-tablestore-grafana-datasource

    The name of the data source. You can enter a custom name. The default value is aliyun-tablestore-grafana-datasource.

    Endpoint

    https://myinstance.cn-hangzhou.ots.aliyuncs.com

    The endpoint of the Tablestore instance. Enter the endpoint of the instance that you want to access. For more information, see Endpoints.

    Instance

    myinstance

    The name of the Tablestore instance.

    AccessId

    ************************

    The AccessKey ID of the Alibaba Cloud account or RAM user that has permissions to access Tablestore.

    AccessKey

    ********************************

    The AccessKey secret of the Alibaba Cloud account or RAM user that has permissions to access Tablestore.

  7. Click Save & test.

    If the connection is successful, the Data source is working message is displayed.

    image

Step 3: Create a dashboard panel

  1. On the Grafana home page, click the image icon in the upper-left corner.

  2. In the navigation pane on the left, click Dashboards.

  3. On the Dashboards page, click New and then select New dashboard.

    image

  4. On the New dashboard page, click + Add visualization.

  5. In the Select data source dialog box, select the configured Tablestore data source.

    image

  6. On the Edit page, configure the query conditions in the Query section.

    The following table describes the parameters.

    Parameter

    Example

    Description

    Query

    SELECT * FROM your_table WHERE $__unixMicroTimeRangeFilter(_time)AND _m_name = "your_measurement" AND tag_value_at(_tags, "your_tag")="your_tag_value"LIMIT 1000

    The SQL query statement. For more information, see Query data.

    Important
    • In the WHERE clause, you must use a predefined macro to filter data by time range, such as $__unixMicroTimeRangeFilter in the example. To view more time macros, click "Show Help" on the configuration page.

      
      

    • If you want to display data in a time series chart, the query must return a time column that is represented by a numeric timestamp. You must also configure the name of the time column.

    Format As

    Timeseries

    The format of the results. Valid values:

    • Timeseries (Default): A standard time series chart.

    • FlowGraph: A multi-dimensional chart.

    • Table: A standard table.

    Time Column

    _time

    The name of the time column in the returned data. The time column is used as the x-axis of the time series chart. This parameter is available when you set Format As to Timeseries or FlowGraph.

    Aggregation Column

    _field_name#:#_double_value

    Converts multiple rows of single-column data at the same point in time into a single row of multi-column data. This is useful for converting single-value model data from a Tablestore time series SQL query into multi-value model data. This parameter is available when you set Format As to FlowGraph. The format is <Data point name column>#:#<Value column>.

  7. Click Run SQL to execute the SQL statement and then view and debug the data.

  8. Configure and save the dashboard panel.

    1. In the right-side pane, set the name, type, and display style of the monitoring chart.

      fig_20220426_dashboard

    2. In the upper-right corner, click Apply.

    3. In the upper-right corner, click Save. In the Save dashboard dialog box, set the Title, Description, and Folder parameters, and then click Save.

Step 4: View monitoring data

  1. On the Grafana home page, click the image icon in the upper-left corner.

  2. In the navigation pane on the left, choose Dashboards. Click the dashboard in the destination folder to view all its monitoring charts.