Managed Service for Grafana integrates with Alibaba Cloud Elasticsearch through the built-in Elasticsearch plug-in. Use the public endpoint of an Elasticsearch cluster to synchronize data to Grafana and build real-time dashboards.
Prerequisites
Before you begin, make sure that you have:
An Alibaba Cloud Elasticsearch cluster with a public endpoint enabled. For more information, see What is Alibaba Cloud Elasticsearch?
A Managed Service for Grafana workspace
The public IP address of your Grafana workspace, available on the Workspace Information page in the Managed Service for Grafana console. For details, see View or modify workspace information
The username and password for your Elasticsearch cluster (default username:
elastic)The public endpoint of your Elasticsearch cluster, available on the Basic Information page in the Elasticsearch console. For details, see View the basic information of a cluster
Step 1: Add the Grafana workspace IP address to the Elasticsearch whitelist
Before Grafana can reach your Elasticsearch cluster, add the Grafana workspace IP address to the cluster's public IP address whitelist.
Log on to the Alibaba Cloud Elasticsearch console.
In the left-side navigation pane, choose Elastic Stack Cloud Native PaaS > Elasticsearch Clusters.
In the top navigation bar, select the resource group and region for your cluster, then click the cluster ID to open its details page.
In the left-side navigation pane, choose Configuration and Management > Security.
In the Network Settings section, click Modify next to Public IP Address Whitelist.
NotePublic Network Address must be turned on before you modify the whitelist. By default, this switch is turned off.
In the Modify Public IP Address Whitelist panel, click Configure next to the default whitelist.
In the Modify IP Address Whitelist dialog box, enter the Grafana workspace IP address in the IP Addresses in Whitelist field.
Click OK.
Step 2: Log on to Grafana
Log on to the ARMS console. In the left-side navigation pane, choose Managed Service for Grafana > Workspace Management.
On the Workspace Management page, find your workspace and click the link in the URL column to open Grafana.
NoteLog on with the Grafana administrator account and the password set during workspace creation, or click Sign in with Alibaba Cloud to use your current Alibaba Cloud account.
Step 3: Add the Elasticsearch data source
Navigate to the data source settings
The data source configuration is the same for Grafana 9.0.x and 10.0.x. Only the navigation path differs.
Grafana 9.0.x
In the left-side navigation pane, choose the gear icon > Data sources.
Click Add data source.
Search for and click Elasticsearch.
Grafana 10.0.x
Click the hamburger menu icon on the Grafana homepage.
In the left-side navigation pane, choose Management > Data sources.
On the Data sources tab, click + Add new data source.
Search for and click Elasticsearch.
Configure the data source
On the Settings tab, configure the following parameters:
| Section | Parameter | Description | Example |
|---|---|---|---|
| Name | A custom name for this data source. | Elasticsearch data source | |
| HTTP | URL | The public endpoint of the Elasticsearch cluster. Format: http://<Elasticsearch-endpoint>:9200. To use HTTPS, first enable HTTPS in the Elasticsearch console. For details on how to find the endpoint, see View the basic information of a cluster. | http://es-cn-xxxxxxxxx.public.elasticsearch.aliyuncs.com:9200 |
| Auth | Basic auth | Turn on this toggle, then configure User and Password below. | N/A |
| Basic Auth Details | User | The username for the Elasticsearch cluster. | elastic |
| Password | The password for the Elasticsearch cluster. If you forgot the password, reset it in the Elasticsearch console: go to cluster details > Configuration and Management > Security > Access Settings > Reset Password. | N/A | |
| Elasticsearch details | Index name | The index to query. If no custom index exists, use the Elasticsearch self-monitoring index to verify connectivity. The self-monitoring index follows the format .monitoring-es-7-<date> (for example, .monitoring-es-7-2022.01.11). Replace the date with a date within the previous two days that is later than the cluster creation date. For more information, see the Grafana Elasticsearch documentation. | .monitoring-es-7-2022.01.11 |
| Time field name | The timestamp field in the index. For the self-monitoring index, set this to timestamp. | timestamp | |
| ElasticSearch version (Grafana 9.0.x only) | The version of the Elasticsearch cluster, available on the Basic Information page in the Elasticsearch console. | 7.10+ |
Save and verify
Click Save & test.
Grafana 9.0.x: The message
Index OK. Time field name OKconfirms a successful connection.Grafana 10.0.x: The message
Data source is workingconfirms a successful connection.
Step 4: Create a dashboard panel
Navigate to the dashboard editor
Grafana 9.0.x
In the left-side navigation pane, choose the dashboard icon > New dashboard.
Click Add a new panel.
Grafana 10.0.x
Click the hamburger menu icon on the Grafana homepage.
In the left-side navigation pane, click Dashboards. Select New dashboard from the New drop-down list.
Click + Add visualization.
Configure and save the panel
Select the Elasticsearch data source you added in Step 3:
Grafana 9.0.x: On the Query tab of the Edit Panel page, select the data source from the Data source drop-down list.
Grafana 10.0.x: In the Select data source dialog box, select the data source.
Configure the visualization. For example, to view a log list with log details, set Metric to Logs and select Logs from the Visualizations drop-down list in the upper-right corner.
Click Apply.
Click the save icon in the upper-right corner, specify a name and directory for the dashboard, then click Save.
Step 5: View monitoring data
Grafana 9.0.x
In the left-side navigation pane, choose the dashboard icon > Browse.
Find the directory and click the dashboard to view the charts.
Grafana 10.0.x
Click the hamburger menu icon in the upper-left corner.
In the left-side panel, click Dashboards. Find the directory and click the dashboard to view the charts.