All Products
Search
Document Center

CloudMonitor:Use Grafana to view monitoring data

Last Updated:Jul 18, 2024

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.

Important

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

  1. 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.
    1. Log on to the server as the root user.
    2. 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

    3. Run the following command to start the Grafana service:
      sudo service grafana-server start
  2. 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.

  3. 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.
    1. 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

    2. 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
    3. Configure the plug-in.
      1. 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

      2. 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
      3. Press Esc, enter :wq, and then press Enter to save and close the defaults.ini file.
    4. Run the following command to restart the Grafana service:
      service grafana-server restart
  4. 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.
    1. Log on to Grafana.
      The logon URL is in the https://Grafana server IP address:3000 format. Example: https://192.168.XX.XX:3000.
    2. In the left-side navigation pane, click the Configuration icon.
    3. On the Data Sources tab, click Add data source in the upper-right corner.
    4. On the Add data source page, click CMS Grafana Service at the bottom.
    5. Enter the name and account information of the CloudMonitor data source.
      ParameterDescription
      NameThe name of the data source. You can use the default name CMS Grafana Service.
      Aliyun UserIdThe ID of your Alibaba Cloud account.
      AccessKeyIdThe 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.
      AccessKeyThe 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.
    6. Click Save & Test.
  5. Add a dashboard and a monitoring chart.
    1. In the left-side navigation pane, click the Create icon.
    2. On the New dashboard page, click Add an empty panel.
    3. On the Query tab, select the CMS Grafana Service data source and configure a metric for a specified Alibaba Cloud service.
      Metrics
      The following table describes the parameters that are used to configure a metric for a specified Alibaba Cloud service.
      ParameterDescription
      NamespaceThe 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.

      MetricThe name of the monitoring metric whose data is reported.

      For more information about the metrics for different cloud services, see Appendix 1: Metrics.

      PeriodThe interval at which monitoring data is reported. Unit: seconds.

      For more information about the time intervals for different cloud services, see Appendix 1: Metrics.

      GroupThe name and ID of the application group that corresponds to the metric whose data is reported.
      DimensionsThe 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-columnThe 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.

    4. In the right-side pane, set the name, type, and layout of the monitoring chart.
    5. In the upper-right corner, click Apply.
      The monitoring chart is created.
    6. In the upper-right corner, click the Save the dashboard icon. Then, specify the name of the dashboard and the folder in which the dashboard resides.
    7. Click Save.
      The dashboard is created.
  6. View monitoring data.
    1. In the left-side navigation pane, choose Dashboard > Manage.
    2. On the Manage tab, click the dashboard.
      View all monitoring charts on the dashboard.