Cloud service observability

更新时间:
复制 MD 格式

Managed Service for Prometheus integrates monitoring data from multiple Alibaba Cloud services and provides default Grafana dashboards and alert rules. This topic uses ApsaraDB RDS for MySQL to demonstrate how to integrate a cloud service with Managed Service for Prometheus. The process for integrating other cloud services is similar.

Prerequisites

Step 1: Integrate cloud service monitoring data

  1. In the left-side navigation pane, click Integration Center.

  2. On the Integration Center page, click the Database tab, and then click Alibaba Cloud RDS Database.

    Note
    • Managed Service for Prometheus relies on Hybrid Cloud Monitoring to obtain monitoring data from cloud services. If Hybrid Cloud Monitoring is not activated on your account, you will be prompted to activate it first. Click Activate Now, go to the Hybrid Cloud Monitoring activation page, and follow the on-screen instructions. For more information, see Activate Hybrid Cloud Monitoring. Using Managed Service for Prometheus to export cloud service monitoring data incurs fees for real-time data export from Hybrid Cloud Monitoring. For more information about billing, see Real-time data export. After activation is complete, click Redetect to continue integrating ApsaraDB RDS for MySQL monitoring data.

    • The activation of Hybrid Cloud Monitoring is an asynchronous operation. If the console still shows that the service is not activated after you click Redetect, wait 10 to 20 seconds and then click Redetect again.

  3. In the dialog box that appears, on the Start Integration tab, select the region where you want to store the data and click OK. The integration of ApsaraDB RDS for MySQL monitoring data takes about 1 to 2 minutes to complete.

    Note
    • Managed Service for Prometheus collects ApsaraDB RDS for MySQL data from all regions associated with your account and aggregates the data into a single Prometheus instance. We recommend that you deploy your Prometheus instance in an Alibaba Cloud region that you frequently use.

    • When Managed Service for Prometheus integrates cloud service monitoring metrics through Hybrid Cloud Monitoring, it enriches the metrics with additional labels. In addition to the original tags from Cloud Monitor, it adds instance metadata, such as instance IDs or tags, as labels to the instance's metrics. This is supported in two ways:

      • Default common tags

        The specific tags vary by cloud service. When Prometheus collects metrics, it attaches other instance-related metadata to the corresponding metrics as tags.

        Tag key

        Description

        id

        The instance ID.

        instanceName

        The instance name.

        resourceGroupId

        The resource group ID.

        resourceGroupName

        The resource group name.

        regionId

        The instance's region.

        zoneId

        The instance's zone.

        userId

        The account ID.

        namespace

        The namespace.

        product

        The cloud service to which the instance belongs.

        measure

        The corresponding metric name in Cloud Monitor.

        measure_desc

        The corresponding metric description in Cloud Monitor.

      • Custom tags

        Tags on a cloud service instance with the prefix o11y.aliyun.dev/ are also added to the metric data as labels. For example, if an instance has the tag o11y.aliyun.dev/project=abc, a new label project="abc" is added to the monitoring metrics.

Step 2: View the monitoring dashboard

  1. In the left-side navigation pane, click Integration Management.

  2. On the Integration Management page, on the Integrated Environments tab, select Cloud Service Region.

  3. In the Cloud Service Region list, click the target environment name to view its details.

  4. On the Component Management tab, in the Addon Type section, click Dashboard to view the built-in Grafana dashboards.

Step 3: Configure alerts

  1. Log on to the Cloud Monitor console.

  2. In the left-side navigation pane, click Integration Management.

  3. On the Integration Management page, on the Integrated Environments tab, select Cloud Service Region.

  4. In the Cloud Service Region list, click the target environment name to view its details.

  5. On the Component Management tab, in the Addon Type section, click Alarm Rules to view the built-in alert rules.

Note

The built-in alert rules generate alert events but do not send notifications. If you want to send alert notifications to an email address or other platforms, click Edit to configure notification methods. On the alert configuration page, you can also customize alert thresholds, duration, and content. For more information about how to configure alerts, see Create a Prometheus alert rule.

Note

In Simple Mode, you can set notification recipients, the notification period, and the repeat policy.

Step 4: Create a custom dashboard

To create custom Grafana dashboards, create a Grafana workspace and design your dashboards in it.

Create a custom workspace

  1. In the left-side navigation pane, click Integration Management.

  2. On the Integration Management page, on the Integrated Environments tab, select Cloud Service Region.

  3. In the Cloud Service Region list, click the target environment name to view its details.

  4. On the Component Management tab, under Basic Information, click the name next to Default Metric Storage.

  5. On the Prometheus instance page, on the Settings tab, under Basic Information, click Create Workspace.

  6. On the Create Workspace page, configure the parameters as prompted, and then click Create Now.

Modify the Grafana workspace

After the workspace is created, return to the Prometheus instance's Settings page. Click the image icon, select the workspace that you just created from the drop-down list, click Confirm, and then click Confirm again.

Log on to Grafana

  1. Log on to the Cloud Monitor console.

  2. In the navigation pane on the left, choose Managed Service for Prometheus > Instances to open the instance list for Managed Service for Prometheus.

  3. Click the name in the Grafana Workspace column for the target instance to log on to Grafana.

Create a cloud resource dashboard

Note
  • This section describes how to create a monitoring dashboard for ECS and ApsaraDB RDS monitoring data. The steps to add other cloud services are similar.

  • This topic uses Grafana 10.0.x as an example.

Create an ECS monitoring panel

  1. On the Dashboards page, click + Create Dashboard, and then click + Add visualization. On the Select data source page, select the default data source.

  2. From the visualization type drop-down list in the upper-right corner, select Table.

  3. At the bottom of the page, click + Query to add queries B and C. To the right of the A, B, and C query sections, click Code.

    1. In the code blocks for queries A, B, and C, enter the following expressions:

      Query

      Expression

      A

      avg(AliyunEcs_cpu_total{})by(regionId,instanceId,instanceName)

      B

      avg(AliyunEcs_memory_usedutilization{})by(regionId,instanceId,instanceName)

      C

      avg(AliyunEcs_net_tcpconnection{state="ESTABLISHED"})by(regionId,instanceId,instanceName)

    2. For each of the queries A, B, and C, click Options, set Format to Table, and set Type to Instant.

  1. Click the Transform tab.

    1. Click + Add transformation, search for Merge, and then click Merge.

    2. Click + Add transformation again, search for Organize fields, and then click Organize fields.

    3. Click the image icon next to Time to hide the field, and then rename the other fields as described in the following table.

      Original name

      New name

      instanceId

      Instance id

      instanceName

      Instance name

      regionId

      Region

      Value #A

      CPU usage (%)

      Value #B

      Memory usage (%)

      Value #C

      Connections

  1. In the panel on the right, click the Overrides tab and configure the parameters.

    1. Click + Add field override, select Fields with name, and then select CPU Utilization (%) and Memory usage (%) from the respective drop-down lists to create two overrides.

    2. In the Override 1 and Override 2 sections, click + Add override property, select Cell options > Cell type, and then select Gauge from the drop-down list. Configure Gauge display mode and Value display as described in the following table.

      Option

      Value

      Gauge display mode

      Retro LCD

      Value display

      Text color

  1. In the upper-right corner, click Save to save the dashboard.

Create an RDS monitoring panel

  1. After the ECS monitoring panel is created, click the Add panel icon image in the upper-right corner and select Visualization from the drop-down list.

  2. From the Data source drop-down list on the left, select the default data source.

  3. In the visualization search box in the upper-right corner, search for and select Table.

  4. At the bottom of the page, click + Query to add queries B and C. To the right of the A, B, and C query sections, click Code.

    1. In the code blocks for queries A, B, and C, enter the following expressions:

      Query

      Expression

      A

      avg(AliyunRds_CpuUsage{engine="MySQL"})by(regionId,instanceId,instanceName)

      B

      avg(AliyunRds_MemoryUsage{engine="MySQL"})by(regionId,instanceId,instanceName)

      C

      avg(AliyunRds_DiskUsage{engine="MySQL"})by(regionId,instanceId,instanceName)

    2. For each of the queries A, B, and C, click Options, set Format to Table, and set Type to Instant.

  5. Click the Transform tab.

    1. Click + Add transformation, search for Merge, and then click Merge.

    2. Click + Add transformation again, search for Organize fields, and then click Organize fields.

    3. Click the image icon next to Time to hide the field, and then rename the other fields as described in the following table.

      Original name

      New name

      Value #A

      CPU usage (%)

      Value #B

      Memory usage (%)

      Value #C

      Disk usage (%)

  6. In the panel on the right, click All. On the Panel options tab, set the Title to RDS Instance.

  7. Click the Overrides tab and configure the parameters.

    1. Click + Add field override, select Fields with name, and then select CPU Utilization (%), Memory usage (%), and Disk usage (%) from the respective drop-down lists to create three overrides.

    2. In the Override 1, Override 2, and Override 3 sections, click + Add override property, select Cell options > Cell type, and then select Gauge from the drop-down list. Configure Gauge display mode and Value display as described in the following table.

      Option

      Value

      Gauge display mode

      Retro LCD

      Value display

      Text color

  8. In the upper-right corner, click Save to save the dashboard.