You can call the DescribeAvailableMetrics operation to query the enhanced monitoring metrics that are available 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 DescribeAvailableMetrics

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

DBInstanceName String Yes pgm-bp1s1j103lo6****

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

ResourceGroupId String No rg-acfmy*****

The ID of the resource group to which the instance belongs.

Response parameters

Parameter Type Example Description
TotalRecordCount Integer 4

The total number of enhanced monitoring metrics that are available for the instance.

RequestId String 5CD61041-35F7-10F7-BE94-33A48B221218

The ID of the request.

Items Array of Metrics

Details of the enhanced monitoring metric.

GroupKey String os.cpu_usage

The key of the group to which the enhanced monitoring metric belongs.

SortRule Integer 1

The serial number of the enhanced monitoring metric.

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.

Unit String %

The unit of the enhanced monitoring metric.

MetricsKey String os.cpu_usage.sys.avg

The key of the enhanced monitoring metric.

GroupKeyType String CPU utilization

The name of the group to which the enhanced monitoring metric belongs.

MetricsKeyAlias String cpu_sys_per_core

The alias of the enhanced monitoring metric.

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.
Dimension String os

The category of the enhanced monitoring metric. Valid values:

  • os: OS metric
  • db: database metric
DBInstanceName String rm-bp1*****

The ID of the instance.

Examples

Sample requests

http(s)://rds.aliyun.cs/?Action=DescribeAvailableMetrics
&DBInstanceName=pgm-bp1s1j103lo6****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeAvailableMetricsResponse>
<TotalRecordCount>2</TotalRecordCount>
<RequestId>A467D279-68A8-57B3-BDA4-35F8B3DDB1B7</RequestId>
<Items>
    <Description>OS CPU utilization, equal to the number of OS-consumed CPUs divided by the total number of CPUs</Description>
    <MetricsKey>os.cpu_usage.sys.avg</MetricsKey>
    <GroupKeyType>CPU utilization</GroupKeyType>
    <GroupKey>os.cpu_usage</GroupKey>
    <Method>avg</Method>
    <Dimension>os</Dimension>
    <Unit>%</Unit>
    <SortRule>1</SortRule>
    <DbType>pgsql</DbType>
    <MetricsKeyAlias>os.cpu_usage.sys</MetricsKeyAlias>
</Items>
<Items>
    <Description>User CPU utilization, equal to the number of user-consumed CPUs divided by the total number of CPUs</Description>
    <MetricsKey>os.cpu_usage.user.avg</MetricsKey>
    <GroupKeyType>CPU utilization</GroupKeyType>
    <GroupKey>os.cpu_usage</GroupKey>
    <Method>avg</Method>
    <Dimension>os</Dimension>
    <Unit>%</Unit>
    <SortRule>2</SortRule>
    <DbType>pgsql</DbType>
    <MetricsKeyAlias>os.cpu_usage.user</MetricsKeyAlias>
</Items>
</DescribeAvailableMetricsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalRecordCount" : 2,
  "RequestId" : "A467D279-68A8-57B3-BDA4-35F8B3DDB1B7",
  "Items" : [ {
    "Description": "OS CPU utilization, equal to the number of OS-consumed CPUs divided by the total number of CPUs",
    "MetricsKey" : "os.cpu_usage.sys.avg",
    "GroupKeyType": "CPU utilization",
    "GroupKey" : "os.cpu_usage",
    "Method" : "avg",
    "Dimension" : "os",
    "Unit" : "%",
    "SortRule" : 1,
    "DbType" : "pgsql",
    "MetricsKeyAlias" : "os.cpu_usage.sys"
  }, {
    "Description": "User CPU utilization, equal to the number of user-consumed CPUs divided by the total number of CPUs",
    "MetricsKey" : "os.cpu_usage.user.avg",
    "GroupKeyType": "CPU utilization",
    "GroupKey" : "os.cpu_usage",
    "Method" : "avg",
    "Dimension" : "os",
    "Unit" : "%",
    "SortRule" : 2,
    "DbType" : "pgsql",
    "MetricsKeyAlias" : "os.cpu_usage.user"
  } ]
}

Error codes

HTTP status code Error code Error message Description
400 InvalidDBInstanceEngineType.Format the DB instance engine type does not support this operation. The error message returned because the operation is not supported by the database engine of the instance.
404 InvalidDBInstanceName.NotFound The database instance does not exist. The error message returned because the name of the instance cannot be found. Verify the instance name and try again.

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