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 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 the following commands to install Grafana:
      Note For more information about the software versions of Grafana and the operating systems that Grafana supports, visit the Grafana download page. In the following example, the Grafana installation package is grafana-8.0.6-1.x86_64.rpm, which indicates Grafana 8.0.6 for Linux.
      • Method 1:

        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:
      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. Create a namespace in Hybrid Cloud Monitoring.
    For more information, see Create a namespace.
  4. 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 CloudMonitor. For more information about how to create a metric import task, see the following topics:
  5. View the URL and the Alibaba Cloud account that you use to connect the namespace to Grafana.
    Note The URL and the Alibaba Cloud account that you obtain in this step are used in Step 6 to create a data source.
    1. Log on to the CloudMonitor console.
    2. In the left-side navigation pane, choose Hybrid Cloud Monitoring > Namespace.
    3. Find the namespace and choose Integrate Other Visualization Solutions > Integrate Self-managed Grafana 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.
      ParameterDescriptionExample
      URLThe 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, or cn-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, or cn-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, or cn-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
      Note The 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 3: Endpoints for reporting monitoring data.
      https://metrichub-cms-cn-hangzhou.aliyuncs.com/proxy/namespace/default-aliyun
      UserThe 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.

      Note The RAM user must be created by the current Alibaba Cloud account and must be authorized to read data from CloudMonitor.
      LTAI4FgrMeKLB7NqDmPe****
      PasswordThe 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.

      Note The RAM user must be created by the current Alibaba Cloud account and must be authorized to read data from CloudMonitor.
      dylEiakiwLFB1CufDyxyCwlCxZ****
  6. 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.
    Important The first time you log on to Grafana, we recommend that you change the password to prevent security risks.
    1. 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.
    2. In the left-side navigation pane, click Configuration.
    3. On the Data Sources tab, click Add data source in the upper-right corner.
    4. On the Add data source page, click Prometheus.
    5. 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, LTAI4FgrMeKLB7NqDmPe**** and dylEiakiwLFB1CufDyxyCwlCxZ****.
        Note If 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.
    6. Click Save & Test.
  7. Add a dashboard and a monitoring chart.
    1. On the left-side navigation submenu, click the Create icon.
    2. On the New dashboard page, click Add an empty panel.
    3. 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.
    4. In the right-side pane, specify 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 directory in which the dashboard resides.
    7. Click Save.
      The dashboard is created.
  8. 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.