You can use enterprise dashboards and Grafana plug-ins to integrate Hybrid Cloud Monitoring with Grafana. You can also use an enterprise dashboard to create self-managed Grafana instances. This topic describes how to use self-managed Grafana to view metric data in a visualized manner.
Prerequisites
Hybrid Cloud Monitoring is activated. For more information, see Activate Hybrid Cloud Monitoring.
Background information
For information about how to integrate Cloud Monitor with Grafana, see Overview.
Procedure
- Install the Grafana software. Note The following example demonstrates how to install Grafana on CentOS. For more information about how to install Grafana on other operating systems, see Install Grafana.
- Log on to the server as the root user.
- Run one of the following commands to install Grafana. Note For more information about the software versions of Grafana and the operating systems supported by Grafana, visit the Grafana download page. In the following example, the Grafana installation package is grafana-8.0.6-1.x86_64.rpm, which is the latest version.
- Method 1:
sudo yum install https://dl.grafana.com/oss/release/grafana-8.0.6-1.x86_64.rpm
- Method 2:
wget https://dl.grafana.com/oss/release/grafana-8.0.6-1.x86_64.rpm
sudo yum localinstall grafana-8.0.6-1.x86_64.rpm
- Method 1:
- Run the following command to start the Grafana service: sudo service grafana-server start
- Optional. Install Grafana panel plug-ins.
If you need to view the monitoring data on a Grafana panel, such as Pie Chart, Gantt, or Worldmap Panel, you must install the corresponding panel plug-in. For more information about how to install Grafana panel plug-ins, visit the Grafana panel plug-in page.
Create a namespace in Hybrid Cloud Monitoring.
For more information, see Create a namespace.
Create a metric import task.
You can create metric import tasks for self-managed data centers, Alibaba Cloud services, and cloud services of third-party providers to import metrics to Cloud Monitor. For more information about how to create a metric import task, see the following topics:
View the URL and the Alibaba Cloud account that you use to connect the namespace to Grafana.
NoteThe URL and the Alibaba Cloud account that you obtain in this step are used in Step 6 to create a data source.
Log on to the Cloud Monitor console.
In the left-side navigation pane, choose .
Find the namespace and choose in the Actions column.
View the URL and the Alibaba Cloud account that you use to connect the namespace from the enterprise monitoring dashboard to Grafana. The following table describes the information about the URL and the Alibaba Cloud account.
Parameter
Description
Example
URL
The URL that you use to connect the namespace from the enterprise monitoring dashboard to Grafana.
URL format:
<Endpoint for reporting monitoring data>/proxy/namespace/<Namespace name>.We recommend that you make API calls by using domain names that contain
cn-hangzhou,cn-shanghai,cn-beijing, orcn-shenzhen. You can monitor the metrics of the resources that reside in these regions. We recommend that you use the following endpoints to report monitoring data:Public endpoints
We recommend that you make API calls over the Internet by using domain names that contain
cn-hangzhou,cn-shanghai,cn-beijing, orcn-shenzhen. You can monitor the metrics of the resources that reside in these regions. The following public domain names are supported:https://metrichub-cms-cn-shanghai.aliyuncs.com
https://metrichub-cms-cn-hangzhou.aliyuncs.com
https://metrichub-cms-cn-beijing.aliyuncs.com
https://metrichub-cms-cn-shenzhen.aliyuncs.com
VPC endpoints
We recommend that you make API calls over virtual private clouds (VPCs) by using the domain names that contain
cn-hangzhou,cn-shanghai,cn-beijing, orcn-shenzhen. You can monitor the metrics of the resources that reside in these regions. The following VPC domain names are supported:http://metrichub-cn-shanghai.aliyun.com
http://metrichub-cn-hangzhou.aliyun.com
http://metrichub-cn-beijing.aliyun.com
http://metrichub-cn-shenzhen.aliyun.com
NoteThe network latency of recommended endpoints is quite lower than the endpoints of other regions. For more information about endpoints for reporting monitoring data, see Appendix 2: Endpoints for reporting monitoring data.
https://metrichub-cms-cn-hangzhou.aliyuncs.com/proxy/namespace/default-aliyunUser
The account that you use to connect the namespace from the enterprise monitoring dashboard to Grafana.
The AccessKey ID of your Alibaba Cloud account or a RAM user within the Alibaba Cloud account. For information about how to obtain an AccessKey ID, see Obtain an AccessKey pair.
NoteThe RAM user must be created by the current Alibaba Cloud account and must be authorized to read data from Cloud Monitor.
yourAccessKeyIDPassword
The account that you use to connect the namespace from the enterprise monitoring dashboard to Grafana.
The AccessKey secret of your Alibaba Cloud account or a RAM user within the Alibaba Cloud account. For information about how to obtain an AccessKey secret, see Obtain an AccessKey pair.
NoteThe RAM user must be created by the current Alibaba Cloud account and must be authorized to read data from Cloud Monitor.
yourAccessKeySecretImportantThe AccessKey pair of an Alibaba Cloud account can be used to call all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M. Keep your AccessKey pair confidential.
We recommend that you do not include your AccessKey pair in files that are easily accessible to others, such as the project code. Otherwise, your AccessKey pair may be leaked and resources in your account become insecure.
Create a data source in Grafana.
Log on to Grafana after it is installed. The default port is 3000 and the default username is admin.
ImportantThe first time you log on to Grafana, we recommend that you change the password to prevent security risks.
Log on to Grafana.
The format of the logon URL is
https://Grafana server IP address:3000. For example, the logon URL can be https://192.168.XX.XX:3000.In the left-side navigation pane, click
. On the Data Sources tab, click Add data source in the upper-right corner.
On the Add data source page, click Prometheus.
On the Settings tab, set the Name, URL, User, and Password parameters. Keep the default values for other parameters.
Name: the name of the data source in Grafana, for example,
Prometheus-test.URL: the URL that you use to connect the namespace from the enterprise monitoring dashboard to Grafana. The URL is obtained from Step 5, for example,
https://metrichub-cms-cn-hangzhou.aliyuncs.com/proxy/namespace/default-aliyun.User and Password: the username and the password that you use to connect the namespace from the enterprise monitoring dashboard to Grafana. The username and the password are the values of User and Password that you obtained in Step 5, for example,
yourAccessKeyIDandyourAccessKeySecret.NoteIf you turn on Basic auth in the Auth section, the values that you specified for the User and Password parameters are displayed in the Basic Auth Details section.
Click Save & Test.
Add a dashboard and a monitoring chart.
On the left-side navigation submenu, click the
icon. On the New dashboard page, click Add an empty panel.
On the Query tab, select Prometheus-test from the Data source drop-down list and then select the metrics for the cloud service for which you want to add a dashboard and a monitoring chart.
In the right-side pane, specify the name, type, and layout of the monitoring chart.
In the upper-right corner, click Apply.
The monitoring chart is created.
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.
The dashboard is created.
- View monitoring data.
- In the left-side navigation pane, choose .
- On the Manage tab, click the dashboard. View all monitoring charts on the dashboard.
> Manage