Add and use a Tablestore data source
Managed Service for Grafana includes a built-in plugin for Alibaba Cloud Tablestore. This plugin lets you synchronize data from Tablestore and visualize it in real time on a Grafana dashboard. This topic describes how to add the Tablestore data source and create a dashboard panel.
Background information
Tablestore is a multi-model structured data storage service developed by Alibaba Cloud. It provides storage for large-scale structured data and offers fast query and analytics capabilities. With its distributed storage and powerful indexing engine, Tablestore supports petabytes of storage, tens of millions of transactions per second (TPS), and millisecond-level latency. For more information, see What is Tablestore.
Prerequisites
-
If you are using Grafana 11.4.x, you must enable the Tablestore data source because AngularJS is disabled by default in this version.
-
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
-
On the Workspace Management page, click the ID of the target Grafana 11.4.x workspace.
-
In the left-side navigation pane, click Parameter Settings. Click Modify Parameters, set security > angular_support_enabled to true, and then click Save and Apply.
-
Step 1: Log on to Grafana
-
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
-
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.
NoteYou can log on to Grafana with the administrator account of Grafana and the password that you configured when you created the workspace. You can also click Sign in with Alibaba Cloud to log on to Grafana with the current Alibaba Cloud account.
Step 2: Configure the data source
Grafana 11.x
-
In the left-side navigation pane, choose .
-
Click Add data source in the middle of the page.
-
On the Add data source page, search for and click aliyun-tablestore-grafana-datasource.
-
On the Settings tab, set the following parameters.
Parameter
Description
Name
A custom name for the data source, such as
aliyun-tablestore-grafana-datasource.Endpoint
The endpoint of the Tablestore instance. For more information, see Obtain an endpoint.
Instance
The name of the Tablestore instance.
AccessId
The AccessKey ID of the Alibaba Cloud account used to access Tablestore. For more information, see Obtain an AccessKey pair.
AccessKey
The AccessKey secret of the Alibaba Cloud account used to access Tablestore. For more information, see Obtain an AccessKey pair.
-
Click Save & test.
If the
Data source is workingmessage appears, the data source is added.
Grafana 10.0.x
-
On the Grafana homepage, click the
icon. -
In the left-side navigation pane, choose .
-
On the Data Source tab, click + Add new data source.
-
On the Add data source page, search for and click aliyun-tablestore-grafana-datasource.
-
On the Settings tab, set the following parameters.
Parameter
Description
Name
A custom name for the data source, such as
aliyun-tablestore-grafana-datasource.Endpoint
The endpoint of the Tablestore instance. For more information, see Obtain an endpoint.
Instance
The name of the Tablestore instance.
AccessId
The AccessKey ID of the Alibaba Cloud account used to access Tablestore. For more information, see Obtain an AccessKey pair.
AccessKey
The AccessKey secret of the Alibaba Cloud account used to access Tablestore. For more information, see Obtain an AccessKey pair.
-
Click Save & test.
If the
Data source is workingmessage appears, the data source is added.
Grafana 9.0.x
-
In the left-side navigation pane, choose
> Data sources, and then click Add data source. -
On the Add data source page, search for and click aliyun-tablestore-grafana-datasource.
-
On the Settings tab, set the following parameters.
Parameter
Description
Name
A custom name for the data source, such as
aliyun-tablestore-grafana-datasource.Endpoint
The endpoint of the Tablestore instance. For more information, see Obtain an endpoint.
Instance
The name of the Tablestore instance.
AccessId
The AccessKey ID of the Alibaba Cloud account used to access Tablestore. For more information, see Obtain an AccessKey pair.
AccessKey
The AccessKey secret of the Alibaba Cloud account used to access Tablestore. For more information, see Obtain an AccessKey pair.
-
Click Save & test.
If the
Data source is workingmessage appears, the data source is added.
Step 3: Create a dashboard panel
Grafana 11.x
-
In the left-side navigation pane, click Dashboards. In the upper-right corner, click Create > New dashboard.
-
On the New dashboard page, click + Add visualization.
-
On the Select data source page, select the data source that you added in Step 2.
-
Configure the query settings as described in the following table, and then click Run SQL.
Parameter
Example
Query
The SQL query to execute. For more information, see the Tablestore documentation.
Sample SQL query:
SELECT * FROM your_table WHERE $__unixMicroTimeRangeFilter(_time) AND _m_name = "your_measurement" AND tag_value_at(_tags, "your_tag")="your_tag_value" LIMIT 1000Note-
In the WHERE clause, use a predefined macro such as
$__unixMicroTimeRangeFilterto filter by time range. For more information about time macros, see Use SQL to query time-series data. -
To display data in a time series chart, the query must return a numeric timestamp column, and you must specify the column's name.
Format As
The format for the query results:
-
Timeseries: A standard time series chart.
-
FlowGraph: A multi-dimensional chart.
-
Table: A standard table.
Time Column
The name of the time column in the query results, which is used for the x-axis.
Aggregation Column
This parameter is required only when Format As is set to FlowGraph. It converts multiple rows of single-column data at the same timestamp into a single row of multi-column data. This is particularly useful for converting single-value model data from Tablestore time series SQL into multi-value model data. The format is
<data_point_name_column>#:#<value_column>. Example:"_field_name#:#_double_value". -
-
In the upper-right corner, click Save dashboard. Set the dashboard name and folder, and then click Save.
Grafana 10.0.x
-
On the Grafana homepage, click the
icon. -
In the left-side navigation pane, click Dashboards. On the page that appears, select New dashboard from the New drop-down list.
-
On the New dashboard page, click + Add visualization.
-
In the Select data source pop-up window, select the data source that you added in Step 2.
-
Configure the query settings as described in the following table, and then click Run SQL.
Parameter
Example
Query
The SQL query to execute. For more information, see the Tablestore documentation.
Sample SQL query:
SELECT * FROM your_table WHERE $__unixMicroTimeRangeFilter(_time) AND _m_name = "your_measurement" AND tag_value_at(_tags, "your_tag")="your_tag_value" LIMIT 1000Note-
In the WHERE clause, use a predefined macro such as
$__unixMicroTimeRangeFilterto filter by time range. For more information about time macros, see Use SQL to query time-series data. -
To display data in a time series chart, the query must return a numeric timestamp column, and you must specify the column's name.
Format As
The format for the query results:
-
Timeseries: A standard time series chart.
-
FlowGraph: A multi-dimensional chart.
-
Table: A standard table.
Time Column
The name of the time column in the query results, which is used for the x-axis.
Aggregation Column
This parameter is required only when Format As is set to FlowGraph. It converts multiple rows of single-column data at the same timestamp into a single row of multi-column data. This is particularly useful for converting single-value model data from Tablestore time series SQL into multi-value model data. The format is
<data_point_name_column>#:#<value_column>. Example:"_field_name#:#_double_value". -
-
Click Apply.
-
In the upper-right corner, click the
icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.
Grafana 9.0.x
-
In the left-side navigation pane of Grafana, choose
> New dashboard. -
On the New dashboard page, click Add a new panel.
-
On the Query tab of the Edit Panel page, select your data source from the Data source drop-down list.
-
Configure the parameters as described in the following table, and then click Run SQL.
Parameter
Example
Query
The SQL query to execute. For more information, see the Tablestore documentation.
Sample SQL query:
SELECT * FROM your_table WHERE $__unixMicroTimeRangeFilter(_time) AND _m_name = "your_measurement" AND tag_value_at(_tags, "your_tag")="your_tag_value" LIMIT 1000Note-
In the WHERE clause, use a predefined macro such as
$__unixMicroTimeRangeFilterto filter by time range. For more information about time macros, see Use SQL to query time-series data. -
To display data in a time series chart, the query must return a numeric timestamp column, and you must specify the column's name.
Format As
The format for the query results:
-
Timeseries: A standard time series chart.
-
FlowGraph: A multi-dimensional chart.
-
Table: A standard table.
Time Column
The name of the time column in the query results, which is used for the x-axis.
Aggregation Column
This parameter is required only when Format As is set to FlowGraph. It converts multiple rows of single-column data at the same timestamp into a single row of multi-column data. This is particularly useful for converting single-value model data from Tablestore time series SQL into multi-value model data. The format is
<data_point_name_column>#:#<value_column>. Example:"_field_name#:#_double_value". -
-
Click Apply.
-
In the upper-right corner, click the
icon. Then, specify the name of the dashboard and the directory in which the dashboard resides. -
Click Save.
Step 4: View the monitoring data
Grafana 11.x
In the left-side navigation pane, click Dashboards. Click a dashboard in the target folder to view its monitoring charts.
Grafana 10.0.x
-
On the Grafana home page, click the
icon in the upper-left corner. -
In the left-side navigation pane, select Dashboards. Click a dashboard in the target folder to view its monitoring charts.
Grafana 9.0.x
-
In the left-side navigation pane, choose
> Browse. -
On the Browse tab, click a dashboard in the target folder to view its monitoring charts.