Consolidate cloud service data from multiple Alibaba Cloud accounts into a single Managed Service for Grafana workspace for unified cross-account monitoring. ECS data is used as an example.
Background
If you manage multiple Alibaba Cloud accounts with cloud services such as ECS, you can consolidate their data into a single Grafana workspace for cross-account monitoring.
Example scenario
The examples below show how to integrate ECS data from Alibaba Cloud accounts A and B into Account A's Grafana workspace, using Grafana v9.0.x and v10.x.
Step 1: Integrate Account A's ECS data
Log on to Alibaba Cloud Account A and integrate its ECS data into Managed Service for Grafana.
-
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
-
On the Workspace Management page, click the ID of the workspace that you want to manage.
-
On the Workspace Information page, click Prometheus Cloud Monitoring Service (Old) in the Cloud Service Integration section.
-
Select the data source to integrate, click Integration in the Actions column, and then click Confirm.
NoteClick Configure Cloud Service Monitoring to connect more cloud services to Managed Service for Prometheus.
An integrated data source shows a status of Integrated in the Status column.
-
Click the folder icon next to the data source to open its dashboard folder on the Grafana Dashboards page.
-
Click the folder to view its dashboards.
Step 2: Add the ECS component
Connect the ECS data from Alibaba Cloud account B to the Managed Service for Prometheus cloud service, and use the Managed Service for Prometheus cloud service to add the ECS data source to the Grafana workspace created by Alibaba Cloud account A.
-
Switch to Alibaba Cloud Account B and log on to the ARMS console.
-
On the Overview page, click Add Other Components in the Access Center section, or click Access Center in the left-side navigation pane.
-
On the Access Center page, click Alibaba Cloud ECS in the Infrastructures section.
-
In the panel that appears, select a storage region and click OK.
-
After the integration is successful, click Data Import Management.
NoteIf the ECS instances in the account are already connected to Managed Service for Prometheus, you can go to the page on the ARMS console. Click the name of an instance whose Instance Type is Prometheus Instance for Cloud Services to view the connected ECS instances.
Step 3: Obtain the HTTP API endpoint
-
In the left navigation pane, click Integration Management.
-
On the Integration Management page, on the Integrated Environments tab, select Cloud Service Region.
-
In the Cloud Service Region list, click the name of the target environment.
-
On the Component Management tab, click the name of Default Metric Storage.
-
On the Modify tab, copy and save the public endpoint from the HTTP API Endpoint (for Grafana Read) field.
NoteUse the public endpoint. The internal endpoint does not support cross-account connections.
Step 4: Configure the Grafana data source
Grafana v9.x
-
Switch to Alibaba Cloud Account A and log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
-
On the Workspace Management page, find the workspace that you want to manage and click the URL in the URL column to go to Grafana.
NoteLog on to Grafana with your Admin credentials or by clicking Sign in with Alibaba Cloud.
-
In the left-side navigation pane of Grafana, choose .
-
On the Data Sources tab, click Add data source.
-
On the Add data source page, click Prometheus.
-
On the Settings page, enter a Name for the data source. In the HTTP section, paste the public endpoint from Step 3 into the URL field.
-
Click Save & test.
A
Data source is workingmessage confirms the data source was added successfully. For additional options, refer to the official Grafana documentation.
Grafana v10.x
-
Switch to Alibaba Cloud Account A and log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
-
On the Workspace Management page, find the workspace that you want to manage and click the URL in the URL column to go to Grafana.
NoteLog on to Grafana with your Admin credentials or by clicking Sign in with Alibaba Cloud.
-
In the left-side navigation pane, click Manage, and then click Data Source.
-
On the data sources page, click + Add data source.
-
On the Add data source page, click Prometheus.
-
On the Settings page, enter a Name for the data source. In the HTTP section, paste the public endpoint from Step 3 into the URL field.
-
Click Save & test.
A
Data source is workingmessage confirms the data source was added successfully. For additional options, refer to the official Grafana documentation.
Step 5: Create a dashboard for Account B
Import and modify Account A's dashboard to create one for Account B's ECS data.
Grafana v9.x
-
In the left-side navigation pane, click the
icon, and then click Browse. -
Click the name of the dashboard that you created in Step 4.
-
At the top of the page, click the
icon, and then click Export. -
On the Export tab, enable Export for sharing externally, and then click Save to file to export the dashboard as a JSON file.
-
In the left-side navigation pane, click the
icon, and then click Import. -
On the Import page, click Upload JSON file, and then open the JSON file exported in Step 4.
-
In the Options section, modify the dashboard information as described in the following table.
Parameter
Description
Name
Custom name for the dashboard.
Folder
Folder to store the dashboard.
Unique identifier (UID)
Click Change uid to assign a unique dashboard UID.
Select a Prometheus data source drop-down list
Select the data source integrated in Step 4.
If the UID conflicts with an existing dashboard, a warning appears. Click Import (Overwrite) to replace the existing dashboard.
-
Click Import. The dashboard appears after a few seconds.
Grafana v10.x
-
In the left-side navigation pane, click Dashboard.
-
On the Dashboard page, click the name of the dashboard that you created in Step 4.
-
At the top of the page, click the
icon, and then click Export. -
On the Export tab, enable Export for sharing externally, and then click Save to file to export the dashboard as a JSON file.
-
In the left-side navigation pane, click Dashboard.
-
On the Dashboard page, click the Create drop-down list, and then click Import.
-
On the Import dashboard page, click the
icon to open the JSON file that you exported in Step 5. -
In the Options section, modify the dashboard information as described in the following table.
Parameter
Description
Name
Custom name for the dashboard.
Folder
Folder to store the dashboard.
Unique identifier (UID)
Click Change uid to assign a unique dashboard UID.
If the UID conflicts with an existing dashboard, a warning appears. Click Import (Overwrite) to replace the existing dashboard.
-
Click Import. The dashboard appears after a few seconds.
Advanced operations
The previous steps use separate dashboards per account. This section shows how to display all data sources in a single unified dashboard.
Grafana v9.x
-
Use Step 4 to add all accounts' cloud service data to Grafana and create a dashboard for one data source.
ImportantUse a consistent naming pattern for data sources so you can filter them with regular expressions.
On the Grafana Configuration > Data sources page, enter keywords in the search box to verify that your naming pattern (for example, suffixes like 001, 002) is easy to filter.
-
In the left-side navigation pane, click the
icon, and then click the name of the data dashboard you created. -
After you open the dashboard, click the
icon in the upper-right corner.
-
In the left-side navigation pane, click Variables, and then click Add variable.
-
On the Edit page, configure the following parameters, and then click Update.
Section
Parameter
Description
General
Name
Custom name for the variable.
Type
Select Data source.
Data source options
Type
Select Prometheus.
Instance name filter
Regular expression to filter data sources, such as
/.*-(.*)-.*/. -
Update all relevant variables and panels to use the new data source variable.
-
Modify variables.
-
On the Variables page, click New.
-
On the Edit page, in the General section, set Type to Query.
-
In the Query Options section, set Data source to the variable name you created in the previous step, such as
${query0}. -
Click Update.
-
-
Modify panels.
-
On the dashboard page, click the panel title, and then click Edit.
-
On the Edit Panel page, on the Query tab, select the variable name you created from the data source drop-down list, such as
${query0}. -
In the upper-right corner, click Apply.
-
-
-
In the upper-right corner of the dashboard page, click the
icon, and then click JSON Model in the left-side navigation pane. -
On the JSON Model page, replace all
datasourcevalues with your variable name.For example: "datasource": { "type": "Prometheus", "uid": "${query0}" }, -
Click Save changes.
-
After saving, use the drop-down menu at the top of the dashboard to switch between data sources.

Grafana v10.x
-
Use Step 4 to add all accounts' cloud service data to Grafana and create a dashboard for one data source.
ImportantUse a consistent naming pattern for data sources so you can filter them with regular expressions.
-
In the left-side navigation pane, click Dashboard, and then click the data dashboard you created.
-
After you open the dashboard, click the
icon in the upper-right corner.
-
In the left-side navigation pane, click Variables, and then click Add variable.
-
Configure the following parameters, and then click Apply.
Parameter
Description
Select variable type
Select Data source.
Name
Custom name for the variable.
Show on dashboard
Select Label and value.
Type
Select Prometheus.
Instance name filter
Regular expression to filter data sources, such as
/.*-(.*)-.*/. -
Update all relevant variables and panels to use the new data source variable.
-
Modify variables.
-
On the Variables page, click + New variable.
-
Configure the following parameters, and then click Apply.
Parameter
Description
Select variable type
Select Query.
Name
Custom name for the variable.
Show on dashboard
Select Label and value.
Data source
Select the variable you created, such as
${query01}.Query
Select your desired Query Type, Label, and Metric.
Sort
Select Disabled.
Refresh
Select On dashboard load.
-
-
Modify panels.
-
On the dashboard page, click the
icon on the target panel, and then click Edit. -
On the Edit Panel page, on the Query tab, select the variable name you created from the data source drop-down list, such as
${query0}. -
In the upper-right corner, click Apply.
-
-
-
In the upper-right corner of the dashboard page, click the
icon, and then click JSON Model in the left-side navigation pane. -
On the JSON Model page, replace all
datasourcevalues with your variable name.For example: "datasource": { "type": "Prometheus", "uid": "${query01}" }, -
Click Save changes.
-
After saving, use the drop-down menu at the top of the dashboard to switch between data sources.

> Data sources