After Tablestore is connected to Grafana, you can use Grafana to display Tablestore data.
Prerequisites
- The first time you use Tablestore, you must first activate Tablestore and create instances and data tables. For more information, see Manage the Wide Column model in the Tablestore console or Manage the Wide Column model in the Tablestore CLI.
- A mapping table is created for a data table or a time series table in Tablestore. For more information, see Create mapping tables for tables and Create mapping tables in the multi-value model for time series tables.
- Open source Grafana later than 8.0.0 is installed. For more information, see Install Grafana.
- An AccessKey pair that consists of an AccessKey ID and an AccessKey secret is obtained. For more information, see Obtain an AccessKey pair.
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 add a Tablestore data source to Grafana, Grafana displays real-time data on a dashboard based on the data of Tablestore.
Usage notes
The support for Grafana is available in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), and Singapore (Singapore).
Step 1: Install the Grafana plug-in for Tablestore
Windows
- Click Grafana plug-in for Tablestore package to download the Grafana plug-in for Tablestore package.
- Extract files from the package to the plugins-bundled directory of the Grafana plug-in.
- Modify the configuration file of Grafana.
- Restart the grafana-server.exe process in Task Manager.
Linux or macOS
- Run the following command to download the Grafana plug-in for Tablestore package:
wget https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20220527/ygdf/tablestore-grafana-plugin-1.0.0.zip
- Extract files from the Grafana plug-in for Tablestore package to a directory of the Grafana plug-in. Run the following command to extract files from the Grafana plug-in for Tablestore package based on the method that is used to install the Grafana plug-in.
- If you use a yum repository or an RPM package to install the Grafana plug-in in Linux, run the unzip tablestore-grafana-plugin-1.0.0.zip -d /var/lib/grafana/plugins command.
- If you use a .tar.gz file to install the Grafana plug-in, run the unzip tablestore-grafana-plugin-1.0.0.zip -d {PATH_TO}/grafana-{VERSION}/data/plugins command.
- Modify the configuration file of Grafana.
- Restart Grafana.
Step 2: Add a data source
- Log on to Grafana.
- Move the pointer over the icon in the left-side navigation pane and click Data sources.
- On the Data sources tab, click Add data source.
- In the Others section of the Add data source page, click aliyun-tablestore-grafana-datasource.
- On the Settings page, configure the parameters. The following table describes the parameters.
Parameter Example Description Name aliyun-tablestore-grafana-datasource The name of the data source. You can retain the default value or enter a custom name. Default value: aliyun-tablestore-grafana-datasource. Endpoint https://myinstance.cn-hangzhou.ots.aliyuncs.com The endpoint of the Tablestore instance. Configure this parameter based on the Tablestore instance that you want to access. For more information, see Endpoints. Instance myinstance The name of the Tablestore instance. AccessId ************************ The AccessKey ID of your Alibaba Cloud account or a RAM user that has permissions to access Tablestore. AccessKey ******************************** The AccessKey secret of your Alibaba Cloud account or a RAM user that has permissions to access Tablestore. - Click Save & test. After the data source is added to Grafana, the Data source is working message appears.
Step 3: Create a dashboard panel
- In the Grafana console, move the pointer over the icon in the left-side navigation pane and click Dashboard.
- On the New dashboard page, click the icon.
- In the Add panel section, click Add a new panel.
- In the Query section of the Edit Panel page, specify the conditions that are used to query data from the data source.
- Click Run SQL to execute SQL statements, view the data, and then perform debugging.
- Configure the dashboard panel and save the configurations.
Step 4: View monitoring data
- In the Grafana console, move the pointer over the icon in the left-side navigation pane and click Browse.
- On the Browse tab, click the monitoring dashboard under the folder that you specified for the dashboard to view all monitoring charts on the dashboard.