You can call the DescribeDBInstanceMetrics operation to query the Enhanced Monitoring metrics that are enabled for an ApsaraDB RDS for PostgreSQL instance.

Prerequisites

Before you call this operation, make sure that the instance runs PostgreSQL.

For more information, see View the Enhanced Monitoring metrics of an ApsaraDB RDS for PostgreSQL instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeDBInstanceMetrics

The operation that you want to perform. Set the value to DescribeDBInstanceMetrics.

DBInstanceName String Yes pgm-bp1s1j103lo6****

The ID of the instance. You can call the DescribeDBInstances operation to query the IDs of instances.

Response parameters

Parameter Type Example Description
Items Array of Metrics

An array that consists of the Enhanced Monitoring metrics that are enabled for the instance.

Description String OS CPU utilization, equal to the number of OS-consumed CPUs divided by the total number of CPUs

The description of the Enhanced Monitoring metric.

Dimension String os

The category of the Enhanced Monitoring metric. Valid values:

  • os: OS metric
  • db: database metric
GroupKey String os.cpu_usage

The key of the group to which the Enhanced Monitoring metric belongs.

GroupKeyType String CPU utilization

The name of the group to which the Enhanced Monitoring metric belongs.

Method String avg

The method that is used to aggregate the monitoring data of the Enhanced Monitoring metric. Valid values:

  • avg: The system calculates the average value of the Enhanced Monitoring metric.
  • min: The system calculates the minimum value of the Enhanced Monitoring metric.
  • max: The system calculates the maximum value of the Enhanced Monitoring metric.
MetricsKey String os.cpu_usage.sys.avg

The key of the Enhanced Monitoring metric.

MetricsKeyAlias String os.cpu_usage.sys

The alias of the Enhanced Monitoring metric.

SortRule Integer 1

The serial number of the Enhanced Monitoring metric.

Unit String %

The unit of the Enhanced Monitoring metric.

RequestId String 318C3754-F6D0-54BB-A55C-23EAA04708B7

The ID of the request.

TotalRecordCount Integer 1

The total number of Enhanced Monitoring metrics that are enabled for the instance.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DescribeDBInstanceMetrics
&DBInstanceName=pgm-bp1s1j103lo6****
&<Common request parameters>

Sample success responses

XML format

<DescribeDBInstanceMetrics>
  <TotalRecordCount>1</TotalRecordCount>
  <RequestId>318C3754-F6D0-54BB-A55C-23EAA04708B7</RequestId>
    <Items>
         <Description>OS CPU utilization, equal to the number of OS-consumed CPUs divided by the total number of CPUs</Description>
         <GroupKeyType>CPU utilization</GroupKeyType>
         <MetricsKey>os.cpu_usage.sys.avg</MetricsKey>
         <GroupKey>os.cpu_usage</GroupKey>
         <Dimension>os</Dimension>
         <Method>avg</Method>
         <Unit>%</Unit>
         <SortRule>1</SortRule>
         <MetricsKeyAlias>os.cpu_usage.sys</MetricsKeyAlias>
    </Items>
</DescribeDBInstanceMetrics>

JSON format

{
    "TotalRecordCount": 1,
    "RequestId": "318C3754-F6D0-54BB-A55C-23EAA04708B7",
    "Items": {
        "Description": "OS CPU utilization, equal to the number of OS-consumed CPUs divided by the total number of CPUs",
        "GroupKeyType": "CPU utilization",
        "MetricsKey": "os.cpu_usage.sys.avg",
        "GroupKey": "os.cpu_usage",
        "Dimension": "os",
        "Method": "avg",
        "Unit": "%",
        "SortRule": 1,
        "MetricsKeyAlias": "os.cpu_usage.sys"
    }
}

Error codes

HTTP status code Error code Error message Description
400 InvalidInstanceMetricsConfigs.NotFound The specified instance has no metrics configs The error message returned because no Enhanced Monitoring metrics are configured for the instance.
404 InvalidDBInstanceName.NotFound The database instance does not exist. The error message returned because the instance name that you specify cannot be found. Check whether the instance name is correct.

For a list of error codes, visit the API Error Center.