All Products
Search
Document Center

:Configure cloud service dashboards that integrate the data of multiple Alibaba Cloud accounts

Last Updated:Mar 18, 2024

Grafana is an open source observability platform for visualizing data from multiple sources. You can use a Grafana account to manage all data that you want to monitor. This topic uses Elastic Compute Service (ECS) as an example to describe how to add the data of cloud services across multiple Alibaba Cloud accounts to a Grafana service.

Background information

If you have multiple Alibaba Cloud accounts and you want to monitor the cloud services (such as ECS) in these accounts, you can use Grafana to integrate all cloud service data into a Grafana workspace.

Example

This topic provides an example of how to integrate the ECS data under Alibaba Cloud accounts A and B into the Grafana workspace under Account A.

Step 1: Integrate the ECS data of Account A and generate a dashboard

You can log on to Alibaba Cloud Account A and integrate its ECS data into Managed Service for Grafana.

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, choose Grafana Service > Workspace Management.
  3. On the Workspace Management page, click the ID of the workspace that you want to manage or click Management in the Actions column.
  4. In the left-side navigation pane, click Cloud service integration.
  5. On the Cloud service integration page, click CloudMonitor on the left.
  6. On the CloudMonitor page, select the region where the data source to be integrated resides, and then click the Add cloud services icon below the ECS dashboard. In the dialog box that appears, click OK.
    Then, Managed Service for Grafana synchronizes the data source and dashboard of the ECS instances under the current Alibaba Cloud account. After a few minutes, the Tick icon icon appears next to the dashboard name. This indicates that the data source and dashboard have been synchronized. View the CloudMonitor dashboard
  7. On the CloudMonitor page, click ViewCloudMonitorDashboard.
  8. On the Manage page of the Grafana console, click the dashboard named CMS-ECS.
    You can view the ECS dashboard that is created by Managed Service for Grafana based on the template. ECD dashboard

Step 2: Integrate the ECS data of Account B

You can first connect the ECS data of Alibaba Cloud Account B to Alibaba Cloud Prometheus Service, and then use Alibaba Cloud Prometheus Service to add the ECS data source to the Grafana workspace created by Alibaba Cloud Account A.

  1. Switch to Account B and log on to the ARMS console.
  2. In the left-side navigation pane, click Overview. In the Integration Center section, click View All. Alternatively, click Integration Center in the left-side navigation pane.
  3. In the Cloud Services section of the Integration Center page, click Alibaba Cloud ECS.
  4. In the Monitor Cloud Services panel, click OK.
    You are redirected to the Cloud Services page of Alibaba Cloud Prometheus Service.
    Note If the ECS instance under the current account has been connected to Alibaba Cloud Prometheus Service, you can go to the ARMS console, choose Prometheus Monitoring > Prometheus Instances in the left-side navigation pane, and click the name of the instance whose Instance Type is Prometheus for Cloud Services to view the ECS instances.
    Cloud service collection list page
  5. In the left-side navigation pane, click Settings.
  6. On the Settings tab, open the Cloud Service:cms collapsible section and copy the public endpoint of HTTP API Address (Grafana Read Address).
    Note The internal endpoint cannot be used because the ECS instances of acounts A and B use different virtual private clouds (VPCs).
  7. Switch to Alibaba Cloud Account A and log on to the ARMS console.
  8. In the left-side navigation pane, choose Grafana Service > Workspace Management. On the page, find the workspace that you want to manage and click the URL in the URL column to go to Grafana.
    Note You can log on to Grafana by using the administrator account of Grafana and the password that you set when you created the workspace, or click Sign in with Alibaba Cloud to log on to Grafana by using the Alibaba Cloud account that was used to create the workspace.
  9. In the left-side navigation pane, choose Settings > Data sources.
  10. On the Data sources tab, click Add data source.
  11. On the Add data source page, click Prometheus.
  12. On the Settings tab, enter the name of the data source in the Name field. In the HTTP section, enter the HTTP API endpoint obtained in Step 6 in the URL field.
  13. Click Save & test.
    If Data source is working appears, it indicates that the ECS data source has been added to Grafana. For more information about other parameters, see Using Elasticsearch in Grafana on the official website of Grafana.

Step 3: Create a Grafana dashboard for the ECS data of Account B

You can use the ECS dashboard template of Account A to create a Grafana dashboard for the ECS data source of Account B.

  1. On the page where displays the dashboard you created in Step 1, click the Share icon icon. On the Export tab, turn on the Export for sharing externally switch and click Save to file.
    Export a dashboard template
    A JSON file will be exported.
  2. In the left-side navigation pane of Grafana, choose + > Import.
  3. On the Import page, click Upload JSON file and select the JSON file exported in Step 3.1.
  4. Modify the dashboard information in the Options section.
    Import the dashboard template
    1. Enter a dashboard name in the Name field.
    2. Select the folder where you want to store the dashboard in the Folder field.
    3. In the Unique identifier (uid) section, click Change uid and modify the UID of the dashboard to ensure that the string is globally unique.
    4. Select the data source that was added in Step 2 from the Select a Prometheus data source drop-down list.
  5. Click Import.
    Wait a few seconds for the modifications to take effect. Dashboard for Account B

Advanced operations

In the preceding steps, you can only integrate the data of multiple Alibaba Cloud accounts to the same Grafana workspace, but you still need to view the dashboards of different accounts separately. The following steps demonstrate how to integrate all data in a single dashboard.

  1. Add the cloud service data of all accounts to Grafana by referring to Step 2.
    Important We recommend that you use a consistent file naming convention so that you can use regular expressions to filter data sources.
    Add a data source
  2. Create a dashboard for any of the data sources by referring to Step 2.
  3. In the upper-right corner of the Dashboards page, click the Settings icon icon. In the left-side navigation pane of the Settings page, click Variables.
  4. On the Variables tab, click New.
  5. On the Edit page, configure the following parameters:
    Add a variable for the data source.
    1. In the General section, enter a name, such as DataSource, in the Name field, and select Type as Data source.
    2. In the Data source options section, select Type as Prometheus. In the Instance name filter field, enter a regular expression that can be used to filter the data source to be added.
    3. Click Update.
  6. Modify the data sources of other variables and panels to the data source added in the previous step.

    Modify the data sources of variables and panels one by one

    • Modify a variable
      1. On the Variables tab, click the variable for which you want to modify the data source.
      2. In the Query Options section of the Edit page, change Data source to the name of the variable created in the previous step, such as ${DataSource}. Modify a variable
      3. Click Update.
    • Modify a panel
      1. Return to the Dashboards page, click the name of the panel for which you want to modify the data source, click the down arrow icon, and click Edit. Edit the panel
      2. On the Query tab of the Edit Panel page, select the name of the variable created in the previous step, such as ${DataSource}, in the default drop-down list. Modify the data source in the panel
      3. In the upper-right corner, click Apply.

    Batch modify the data sources of variables and panels

    1. In the upper-right corner of the Dashboards page, click the Settings icon icon. In the left-side navigation pane of the Settings page, click JSON Model.
    2. On the JSON Model page, batch modify datasource to the variable name created in the previous step, such as ${DataSource}.
      "datasource": "${DataSource}"
    3. Click Save Changes.
  7. After the modifications take effect, you can view the dashboards of different data sources by switching data sources on the Dashboards page.
    Switch data sources