By default, Grafana Service is integrated with Alibaba Cloud Tablestore. You can use the Tablestore plug-in to synchronize data from Tablestore to Grafana and display data in Grafana dashboards. This topic describes how to synchronize data from Tablestore to Grafana and use a Tablestore data source to create a dashboard panel.

Background information

Tablestore is a storage service that is developed by Alibaba Cloud. Tablestore can store large volumes of structured data by using multiple models, and supports fast data queries and analytics. Tablestore uses a distributed storage architecture and an index-based search engine. Tablestore can store petabytes of data and process tens of millions of transactions per second at ultra-low latency (milliseconds). For more information, see What is Tablestore?.

Procedure

  1. Log on to the ARMS console .
  2. In the left-side navigation pane, choose Grafana Service > Workspace Management.
  3. On the Workspace Management page, find the workspace that you want to manage and click the URL in the URL column to go to Grafana.
    Note You can log on to Grafana by using the administrator account of Grafana and the password that you set when you created the workspace, or click Sign in with Alibaba Cloud to log on to Grafana by using the Alibaba Cloud account that was used to create the workspace.
  4. In the left-side navigation pane, choose Settings > Data sources.
  5. On the Data sources tab, click Add data source.
  6. Search for aliyun-tablestore-grafana-datasource in the box at the top of the page, and then click aliyun-tablestore-grafana-datasource.
  7. On the Settings page, configure the following parameters.
    Parameter Description
    Name The name of the data source. The name can be user-defined.
    Endpoint The endpoint of the Tablestore instance. For more information, see Query endpoints.
    Instance The name of the Tablestore instance.
    AccessId The AccessKey ID of the Alibaba Cloud account that is used to access the Tablestore instance. For more information about how to obtain an AccessKey pair, see Obtain an AccessKey pair.
    AccessKey The AccessKey secret of the Alibaba Cloud account that is used to access the Tablestore instance. For more information about how to obtain an AccessKey pair, see Obtain an AccessKey pair.
  8. Click Save & test.
    If Data source is working appears, the Tablestore data source is added to Grafana.

Create a dashboard panel

  1. In the left-side navigation pane of the Grafana console, choose + > Dashboard.
  2. On the New dashboard page, click Add an empty panel.
  3. On the Edit Panel page, select the Tablestore data source from the drop-down list in the Query section and set the following parameters.
    Create a panel for the Tablestore data source
    Parameter Example
    Query The SQL statement. For more information, see Tablestore documentation.

    Example:

    SELECT
      *
    FROM
      your_table
    WHERE
      $__unixMicroTimeRangeFilter(_time)
      AND _m_name = "your_measurement"
      AND tag_value_at(_tags, "your_tag")="your_tag_value"
    LIMIT 1000
    Note
    • In the WHERE clause, the time range condition that is used to filter data is specified by using a predefined macro. In this example, the predefined macro is $__unixMicroTimeRangeFilter. For more information, see Use SQL to query time series data.
    • If you want data to be displayed in a time series chart, a time column that uses timestamps must be returned. You must specify the name of the time column.
    Format As The format of the results. Valid values:
    • Timeseries: displays the query results in a regular time series chart.
    • FlowGraph: displays the query results in a multi-dimensional chart.
    • Table: displays the query results in a regular table.
    Time Column The name of the time column in the query results that are returned. The time column is used as the x-axis of the time series chart.
    Aggregation Column This parameter is required when the Format As parameter is set to FlowGraph. This parameter is used to convert data in multiple rows of a single column at a specified point in time into data in multiple columns of a single row at the specified point in time. This parameter is suitable for converting data that uses a single-value model into data that uses a multi-value model. Data that uses a single-value model is obtained when you use SQL statements to query time series data in Tablestore. Format: <Data point name column >#:#<Value column>. Example: "_field_name#:#_double_value".
  4. Click Run SQL to execute the SQL statement, view data, and then perform debugging.
  5. In the right-side pane, specify the name, type, and layout of the monitoring chart.
  6. In the upper-right corner, click Apply.
    The dashboard panel is created.
  7. In the upper-right corner, click the Save icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.
  8. Click Save.
    The dashboard is created.

View monitoring data

  1. In the left-side navigation pane, choose Dashboard > Manage.
  2. On the Manage tab, find the directory in which the dashboard is stored and click the dashboard.
    View all monitoring charts on the dashboard.