The Alibaba Cloud Lindorm data source plug-in lets you connect Grafana to LindormTSDB and visualize time series data in dashboards. This topic covers two setup paths:
Choose the path that matches your deployment.
Quick reference
| Configuration item |
Managed Service for Grafana |
Self-managed Grafana on ECS |
| Grafana version used in examples |
10.0.x |
8.2.2-1 |
| Plugin name (search in Grafana) |
Alibaba Cloud Lindorm |
Alibaba Cloud Lindorm |
| URL (same VPC) |
Not applicable — use Internet endpoint |
VPC endpoint of LindormTSDB |
| URL (different VPC / Internet) |
Internet endpoint of LindormTSDB |
Internet endpoint of LindormTSDB |
| Basic auth |
Optional — enable if LindormTSDB auth is on |
Optional — enable if LindormTSDB auth is on |
| Database |
Optional |
Optional |
| Success message |
test success |
test success |
Connect using Managed Service for Grafana
Prerequisites
Before you begin, make sure you have:
Add LindormTSDB as a data source
The following steps use Grafana 10.0.x as an example.
-
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management, then click the workspace you want to use.
-
In the Basic Information section, enter the username and password. The username is admin. The password is the one you set when you created the workspace.
-
Click the icon in the upper-left corner, select Manage, and then click Data sources.
-
Click Add data source. Search for Alibaba Cloud Lindorm, then click the result.
-
On the Settings tab, configure the following parameters. Leave other parameters at their default values.
| Configuration item |
Parameter |
Required |
Description |
| Name |
Yes |
A name for this data source. |
| HTTP |
URL |
Yes |
The Internet endpoint of LindormTSDB. See View the endpoints of LindormTSDB. Make sure the Grafana service's public IP address is added to the Lindorm instance whitelist. |
| Auth |
Basic auth |
No |
Enable if user authentication is turned on for LindormTSDB. Enter credentials in the Basic Auth Details section. See User and permission management. |
| Basic Auth Details |
User |
No |
The username for the Lindorm instance. Required if Basic auth is on. |
| Password |
No |
The password for the Lindorm instance. Required if Basic auth is on. |
| Lindorm TSDB Details |
Database |
No |
The LindormTSDB database to access. |
-
Click Save & test. A test success message confirms the connection is working.
Build a dashboard and query data
-
Click Build a dashboard.
-
On the New Dashboard page, click Add a new panel.
-
Select the Lindorm data source you added from the Data source drop-down list.
-
On the Query tab, query your data using the SQL statement editor or the template-based query editor described in Query editors.
Connect using self-managed Grafana on ECS
Deployment requirements
-
Operating system: 64-bit CentOS 7.3 or later
-
Hardware: more than 1 CPU core, 2 GB of memory, and 10 GB of available storage
Prerequisites
Before you begin, make sure you have:
-
A security group rule that allows inbound traffic on port 3000. See Add a security group rule.
-
The ECS instance IP address added to the Lindorm instance whitelist:
-
If you access the Grafana web UI over the Internet: a public IP address allocated for the ECS instance.
Step 1: Install Grafana
Skip this step if Grafana is already installed.
-
Connect to your ECS instanceConnect to an ECS instance.
-
Download Grafana:
This example uses Grafana 8.2.2-1. To install a different version, visit the Grafana download page.
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.2.2-1.x86_64.rpm
-
Install Grafana:
sudo yum install grafana-enterprise-8.2.2-1.x86_64.rpm
-
Start Grafana:
sudo service grafana-server start
Step 2: Install the Alibaba Cloud Lindorm plug-in
-
Download the plug-in:
wget https://tsdbtools.oss-cn-hangzhou.aliyuncs.com/grafana-alibabacloud-lindorm-datasource-latest.zip
-
Extract it to the plugins directory (default: /var/lib/grafana/plugins/):
unzip grafana-alibabacloud-lindorm-datasource-latest.zip -d /var/lib/grafana/plugins/
-
Open the Grafana configuration file (default: /etc/grafana/grafana.ini):
sudo nano -w /etc/grafana/grafana.ini
-
In the [plugins] section, find the line ;allow_loading_unsigned_plugins= and replace it with:
Important
Delete the leading semicolon (;). The semicolon comments out the setting and must be removed for the change to take effect.
allow_loading_unsigned_plugins = alibabacloud-lindorm-datasource
Press Ctrl+O to save, then press Enter to confirm and exit.
-
Restart Grafana to apply the change:
sudo service grafana-server restart
Step 3: Add LindormTSDB as a data source
-
Open a browser and go to http://<ECS-IP>:3000/. Replace <ECS-IP> with the public IP address or primary private IP address of your ECS instance.
-
Log in. For a first-time login, both the username and password are admin. Change the password after logging in. See Sign in to Grafana.
-
Click the settings icon on the left and select Data Sources.
-
On the Configuration page, click Add data source. Search for Alibaba Cloud Lindorm, then click Select.
-
On the Settings tab, configure the following parameters. Leave other parameters at their default values.
| Configuration item |
Parameter |
Required |
Description |
| Name |
Yes |
A name for this data source. |
| HTTP |
URL |
Yes |
The endpoint of LindormTSDB. See View the endpoints of LindormTSDB. Use the VPC endpoint if the ECS and Lindorm instances are in the same VPC; otherwise use the Internet endpoint. Make sure the corresponding IP address (private or public) is added to the whitelist. |
| Auth |
Basic auth |
No |
Enable if user authentication is turned on for LindormTSDB. Enter credentials in the Basic Auth Details section. See User and permission management. |
| Basic Auth Details |
User |
No |
The username for the Lindorm instance. Required if Basic auth is on. |
| Password |
No |
The password for the Lindorm instance. Required if Basic auth is on. |
| Lindorm TSDB Details |
Database |
No |
The LindormTSDB database to access. |
-
Click Save & test. A test success message confirms the connection is working.
Step 4: Build a dashboard and query data
After connecting, create dashboards and panels to visualize your data. See Create a dashboard for general Grafana guidance.
On the Query tab of any panel, select your Lindorm data source from the Data source drop-down list, then query data using one of the editors described below.
Query editors
Both setup paths use the same query editors on the Query tab.
SQL statement editor
Switch to Raw Query Mode by clicking the toggle icon in the upper-right corner of the A section. In this mode, write Lindorm SQL directly for complex queries.
Example:
SELECT region, time, avg(temperature) FROM sensor
WHERE time >= $from AND time <= $to
SAMPLE BY $interval
Time variables
Grafana substitutes these variables with values from the dashboard time range selector:
| Variable |
What it resolves to |
Required |
$from |
Start of the selected time range |
Yes |
$to |
End of the selected time range |
Yes |
$interval |
Calculated interval based on the time range and panel size |
No |
Important
time >= $from AND time <= $to is required in every query. Without this condition, the query returns no results.
To adjust $interval, click Query options and set Min interval and Max data points.
Additional options
-
`ALIAS BY` — Renames time series tags in the legend. Use the format $tag_<tag_name>. For example, $tag_host labels each series by its host name.
-
`OFFSET` — Shifts the query time window, useful for overlaying data from different periods on the same panel.
For the full SQL syntax reference, see Basic syntax of SELECT statements.
Template-based query editor
Use the template editor for straightforward queries without writing SQL. Select fields, tables, filters, and aggregations from drop-down menus.
| Keyword |
What it does |
SELECT |
Choose the fields to return. |
FROM |
Choose the table to query. |
WHERE |
Add filter conditions. |
GROUP BY |
Add aggregation conditions. |
SAMPLE BY |
Set the downsampling interval. See Downsampling queries. Adjust using Min interval and Max data points under Query options. |
ORDER BY TIME |
Sort results by time (ascending or descending). |
LIMIT |
Cap the number of rows returned. |
ALIAS BY |
Rename the time series tag in the legend. Format: $tag_<tag_name>, for example $tag_host. |
OFFSET |
Shift the query time window to compare data from different periods. |