Updated on 2025-08-12 GMT+08:00

Monitoring

A Prometheus instance for cloud services can be used to monitor multiple metrics of CCI 2.0. For details, see Prometheus Monitoring Overview.

Constraints

Only one Prometheus instance for cloud services can be created in an enterprise project.

CCI 2.0 supports monitoring only in the TR-Istanbul, AF-Johannesburg, AP-Singapore, and ME-Riyadh regions.

Step 1: Create a Prometheus Instance

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane on the left, choose Metric Browsing > Prometheus Monitoring. On the displayed page, click Add Prometheus Instance.
  3. Set the instance name, enterprise project, and instance type.

    If the CCE Cloud Bursting Engine for CCI add-on is being used or required, the CCE cluster also needs this Prometheus instance, with the instance type set to Prometheus for CCE.

  4. Click OK.

Step 2: Obtain the Access Code

  1. Click the name of the created Prometheus instance.
  2. In the navigation pane, choose Settings. In the Credential area, click Add Access Code.
  3. Click OK.

  4. Obtain the values of <project_id>, <aom_id>, and <aom_secret>.

  5. Combine the obtained values into a character string in the format of <project_id>_<aom_id>: <aom_secret>.

    There must be a space after the colon (:).

  6. Encode the character string using Base64.

    You can run the following shell commands for encoding:

    project_id=<project_id>
    aom_id=<aom_id>
    aom_secret=<aom_secret> 
    echo -n "${project_id}_${aom_id}: ${aom_secret}" |base64 -w 0
  7. Fill the Base64-encoded character string in the following template to replace {AOMAuthBase64}, and then copy the code.
    kind: Secret 
    apiVersion: cci/v2 
    metadata:  
      name: cci-aom-app-secret 
    data:
      aom_auth: {AOMAuthBase64}
    type: cci/secure-opaque
  8. Log in to the CCI 2.0 console.
  9. In the navigation pane, choose Configuration Center.
  10. Click the Secrets tab.
  11. Click Create from YAML and use the copied code to replace the code on the CCI 2.0 console to create an AOM app secret.

Step 3 Create a Pod

  1. Log in to the CCI 2.0 console.
  1. In the navigation pane, choose Workloads. On the displayed page, click the Pods tab.
  2. Click Create Pod and configure the parameters. For details about the parameters, see Creating a Pod.

  3. Click Create Now.

Step 4 View Monitoring Data

There are two ways to view monitoring data of a pod: All metrics and Prometheus statement.

Method 1: All Metrics
  1. Log in to the AOM 2.0 console.
  2. In the navigation pane, choose Metric Analysis > Metric Browsing.
  3. On the Metric Sources tab, select the Prometheus instance created in Step 1: Create a Prometheus Instance.

  4. On the All metrics tab, click the text box of Metric.
  5. Select CCI on the right and select related common metrics.

  6. View metrics.

Method 2: Prometheus Statement

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane, choose Metric Analysis > Metric Browsing.
  3. On the Metric Sources tab, select the Prometheus instance created in Step 1: Create a Prometheus Instance.

  4. On the Prometheus statement tab, enter a Prometheus statement in the search box and click .

    The following are examples of common Prometheus statements.

    1. Prometheus statement for querying the vCPU usages of all pods:
      sum(rate(container_cpu_usage_seconds_total{cluster="cci", image!=""}[5m])) by (pod, namespace) / (sum(container_spec_cpu_quota{cluster="cci", image!=""}/100000) by (pod, namespace)) * 100

    2. Prometheus statement for querying the vCPU usage of a pod (<pod_name> indicates the pod name):

      sum(rate(container_cpu_usage_seconds_total{cluster="cci", image!="", pod="<pod_name>"}[5m])) by (pod, namespace) / (sum(container_spec_cpu_quota{cluster="cci", image!="", pod="<pod_name>"}/100000) by (pod, namespace)) * 100

    3. Prometheus statement for querying the vCPU usage of a container (<pod_name> indicates the pod name, and <container_name> indicates the container name):
      sum(rate(container_cpu_usage_seconds_total{cluster="cci", image!="", pod="<pod_name>", container="<container_name>"}[5m])) by (pod, namespace, container) / (sum(container_spec_cpu_quota{cluster="cci", image!="", pod="<pod_name>", container="<container_name>"}/100000) by (pod, namespace, container)) * 100

    4. Prometheus statement for querying the used memory of all pods:
      sum(container_memory_working_set_bytes{cluster="cci", image!=""}) by (pod, namespace)

    5. Prometheus statement for querying the used memory of a pod (<pod_name> indicates the pod name):
      sum(container_memory_working_set_bytes{cluster="cci", image!="", pod="<pod_name>"}) by (pod, namespace)

    6. Prometheus statement for querying the used memory of a container (<pod_name> indicates the pod name, and <container_name> indicates the container name):
      container_memory_working_set_bytes{cluster="cci", image!="", pod="<pod_name>", container="<container_name>"}

    7. Prometheus statement for querying the memory usage of all pods:
      sum (container_memory_working_set_bytes{cluster="cci", image!=""}) by (pod, namespace) / sum(container_spec_memory_limit_bytes{cluster="cci", image!=""}) by (pod, namespace) * 100 !=+Inf

    8. Prometheus statement for querying the memory usage of a pod (<pod_name> indicates the pod name):
      sum (container_memory_working_set_bytes{cluster="cci", image!="", pod="<pod_name>"}) by (pod, namespace) / sum(container_spec_memory_limit_bytes{cluster="cci", image!="", pod="<pod_name>"}) by (pod, namespace) * 100 !=+Inf

    9. Prometheus statement for querying the memory usage of a container (<pod_name> indicates the pod name, and <container_name> indicates the container name):
      container_memory_working_set_bytes{cluster="cci", image!="", pod="<pod_name>", container="<container_name>"} / container_spec_memory_limit_bytes{cluster="cci", image!="", pod="<pod_name>", container="<container_name>"} * 100 !=+Inf

For more monitoring and O&M methods, see Creating a Dashboard.