Grafana is an open source visualization tool that can display large amounts of metric data. Grafana is widely used in Internet application analysis, industrial monitoring, meteorological monitoring, home automation, process management, and other fields. After you connect an ApsaraDB for Lindorm (Lindorm) TSDB instance to Grafana, you can use the visualization features provided by Grafana to monitor and analyze the data collected from the instance.

This topic describes how to connect a Lindorm TSDB instance to Grafana.

Prepare the environment

This topic describes how to install Grafana on an Elastic Compute Service (ECS) instance and connect Grafana to a Lindorm TSDB instance by using a virtual private cloud (VPC).

Create a Lindorm TSDB instance. Create an ECS instance. Connect the Lindorm TSDB instance and the ECS instance to the same VPC. Make sure that the following requirements are met:

  • The OS of the ECS instance is 64-bit CentOS 7.3.
  • The ECS instance has at least one CPU core and 2 GB memory. The available disk storage is no less than 10 GB.
  • The private IP address of the ECS instance in the VPC is added to the whitelist of the Lindorm TSDB instance.
  • If you want to use a browser to access Grafana over the Internet, configure a public IP address for the ECS instance.
  • You have created a security group rule in the ECS console to enable access to the ECS instance over port 3000. The security group rule is shown in the following figure.
Note For more information about how to use ECS, see What is ECS?.

Install and configure Grafana

Perform the following steps to install and start Grafana on the ECS instance:

  1. Run the following command on the ECS instance to install Grafana:
    $ sudo yum install
    Note For more information, see Grafana official documentation.
  2. Run the following command to start the Grafana service:
    $ sudo service grafana-server start

Connect the Lindorm TSDB instance to Grafana

Perform the following steps to connect the Lindorm TSDB instance to Grafana:
  1. Connect to the ECS instance over port 3000 by using a browser. The Grafana logon page appears. For example, if the public IP address of the ECS instance is, enter in the address bar of your browser.
  2. On the Grafana logon page, enter the username admin and the password admin. The Grafana homepage appears.
  3. Create a data source in Grafana. You can use the default values of some parameters. However, you must specify the following parameters:
    • Set the database type to OpenTSDB.
    • URL: Enter the private IP address of the time series engine in the VPC. To view this address, go to the Instance list page in the Lindorm console, and check the value in the VPC Network Address field in the Basic Information section.
    • Version: Select ==2.3.
    • If you activate the user management feature for the Lindorm TSDB instance, you must select Basic Auth and With Credentials and enter the authentication information of a user that has the read permissions.

Click Save & Test. If the Data source is working message appears on the page, the Lindorm TSDB instance is connected to Grafana.

After you perform the preceding operations, you can create and use dashboards in Grafana. For more information, see Grafana official documentation.

Create a monitoring dashboard that displays specific metrics
1.On the homepage of Grafana, choose Create > Dashboard, as shown in the following figure.
Note The following snapshots are created based on Grafana 6.2. If the version of Grafana is not 6.2, the layout of the Grafana console may be different from that in the following snapshots.
tpIf an existing dashboard is connected to the Lindorm TSDB instance, you can select the existing dashboard.
2.On the New dashboard page, click New Panel. In the dialog box that appears, click Add Query. The following figure shows the
3.In the following panel editing window, configure parameters as
  • Specify the metric that you need to monitor and whether to aggregate the metric values in different time series.
  • Configure the parameters of the downsampling policy, including interval, Aggregator, and Fill.
  • Specify the tags that are used to define the time series to be monitored. If you need to monitor the time series that correspond to all the tag values of a tag, enter an asterisk (*) in the Tags field. Note: Grafana supports multiple aggregators. For information about the aggregators that are supported by Lindorm TSDB, see Query single-value data points.
You can also use Grafana to display the multi-value data points in a Lindorm TSDB instance. If you enter the metric in a single-value or multi-value model, only the name of the metric is displayed in the drop-down list. After you enter the name of the metric in a multi-value model, enter an at sign (@). Then, the drop-down list provides all the fields of the metric. You can select the field that you want to view.
Notice Grafana displays only NUMERIC values. Lindorm TSDB supports NUMERIC, STRING, and BOOLEAN values.
Use variables to simplify time series filtering

You can specify the time series that you need to display by specifying the metric, tag key, and tag value when you add a query in the dashboard, as described in the preceding section. However, if multiple time series exist and the number of time series is increasing at a high rate, you must specify Metric and Tags for each new time series to display the time series in an existing panel. This may increase your workload. To simplify the procedure, Grafana allows you to use variables.

This section describes how to use variables to filter the time series to be displayed. In the example, a variable is created and used to filter tags.

1.On the homepage of a selected dashboard, click the Settings
2.On the Variables page, configure the variable to be created and specify how to query the variable values.
  • Set Data source to OpenTSDB.
  • In the Query field, enter a query expression that is supported by Grafana to query data in OpenTSDB. In this example, the variable to be created represents the tag value. Therefore, an expression that starts with tag_values is used.
  • Lindorm TSDB supports all the template query variables that Grafana provides for OpenTSDB:
    • metrics(prefix): returns all the metrics that have the specified prefix. This expression may return an empty array.
    • tag_names(metric): returns all the tag keys that correspond to the specified metric.
    • tag_values(metric, tagKey): returns all the tag values that correspond to the specified metric and the specified tag key.
    • suggest_tagk(prefix): returns all the tag keys that have the specified prefix.
    • suggest_tagv(prefix): returns all the tag values that have the specified prefix.
For more information about the preceding query expressions, see Grafana official documentation.
Note The preceding description indicates that a query expression returns all entries that meet the specified requirement. However, in all available versions of Grafana, a query expression returns only a limited number of entries. This indicates that some expected metrics, tag keys, or tag values may not be returned. The Grafana community is aware of this issue. For more information, see Limits on the number of entries return by a query expression.
3.After the variable is configured, you can use $variable name to reference the query variable when you create or edit a panel in the dashboard. tpThis way, you do not need to edit the panel again when a time series is generated because a new tag value is written.