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 Grafana plug-ins to view the monitoring data in a visualized manner.
The CloudMonitor data source plug-in aliyun_cms_grafana_datasource is no longer maintained and updated. The plug-in does not support Grafana 11.0.0. We recommend that you do not use Grafana 11.0.0. We recommend that you use Hybrid Cloud Monitoring.
Background information
For more information about how to integrate CloudMonitor 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.
- Install the CloudMonitor data source plug-in. Note The latest version of the plug-in is v2.0.1. Alert rules cannot be set for the monitoring data in this version.
- Run the following commands to download the plug-in to the /var/lib/grafana/plugins/ directory:
cd /var/lib/grafana/plugins/
wget https://github.com/aliyun/aliyun-cms-grafana/releases/download/v2.0/aliyun_cms_grafana_datasource_v2.0.1.tar.gz
- Run the following command to decompress the plug-in to the aliyun_cms_grafana_datasource directory: tar -xzf aliyun_cms_grafana_datasource_v2.0.1.tar.gz
- Configure the plug-in.
- Run the following commands to open the configuration file named defaults.ini in /usr/share/grafana/conf:
cd /usr/share/grafana/conf
vi defaults.ini
- Set the
allow_loading_unsigned_plugins
parameter to aliyun_cms_grafana_datasource. This allows Grafana to run the CloudMonitor data source plug-in that is not signed.The following code demonstrates how to set the allow_loading_unsigned_plugins parameter to aliyun_cms_grafana_datasource:allow_loading_unsigned_plugins = aliyun_cms_grafana_datasource
- Press Esc, enter :wq, and then press Enter to save and close the defaults.ini file.
- Run the following commands to open the configuration file named defaults.ini in /usr/share/grafana/conf:
- Run the following command to restart the Grafana service: service grafana-server restart
- Run the following commands to download the plug-in to the /var/lib/grafana/plugins/ directory:
- Create a CloudMonitor data source. Log on to Grafana after it is installed. The default port is 3000 and the default username is admin.Important To prevent security risks, we recommend that you change the password the first time you log on to Grafana.
- Log on to Grafana. The logon URL is in the
https://Grafana server IP address:3000
format. Example: https://192.168.XX.XX:3000. - In the left-side navigation pane, click the icon.
- On the Data Sources tab, click Add data source in the upper-right corner.
- On the Add data source page, click CMS Grafana Service at the bottom.
- Enter the name and account information of the CloudMonitor data source.
Parameter Description Name The name of the data source. You can use the default name CMS Grafana Service. Aliyun UserId The ID of your Alibaba Cloud account. AccessKeyId The AccessKey ID of your Alibaba Cloud account or a RAM user within the Alibaba Cloud account. For more information about how to obtain an AccessKey ID, see Obtain an AccessKey pair. Note The RAM user must be created by the current Alibaba Cloud account and authorized to read data from CloudMonitor.AccessKey The AccessKey secret of your Alibaba Cloud account or a RAM user within the Alibaba Cloud account. For more information about how to obtain an AccessKey secret, see Obtain an AccessKey pair. Note The RAM user must be created by the current Alibaba Cloud account and authorized to read data from CloudMonitor. - Click Save & Test.
- Log on to Grafana.
- Add a dashboard and a monitoring chart.
- In the left-side navigation pane, click the icon.
- On the New dashboard page, click Add an empty panel.
- On the Query tab, select the CMS Grafana Service data source and configure a metric for a specified Alibaba Cloud service. The following table describes the parameters that are used to configure a metric for a specified Alibaba Cloud service.
Parameter Description Namespace The namespace to which monitoring data is reported. Specify a namespace in the acs_service name
format.For more information about the namespaces for different cloud services, see Appendix 1: Metrics.
Metric The name of the monitoring metric whose data is reported. For more information about the metrics for different cloud services, see Appendix 1: Metrics.
Period The interval at which monitoring data is reported. Unit: seconds. For more information about the time intervals for different cloud services, see Appendix 1: Metrics.
Group The name and ID of the application group that corresponds to the metric whose data is reported. Dimensions The dimensions that are used to query the monitoring data of specified resources. You can specify multiple dimensions at a time. Specify each dimension as a key-value pair, for example,
instanceId:i-2ze2d6j5uhg20x47****
.For more information about the dimensions for different cloud services, see Appendix 1: Metrics.
Y-column The statistical method that is used to report monitoring data. Valid values: Average, Maximum, Minimum, and Sum. For more information about the statistical methods for different cloud services, see Appendix 1: Metrics.
- In the right-side pane, set 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 folder 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.