You can call the ModifyDBInstanceMetrics operation to modify the Enhanced Monitoring metrics that are displayed 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
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyDBInstanceMetrics |
The operation that you want to perform. Set the value to ModifyDBInstanceMetrics. |
DBInstanceName | String | Yes | pgm-bp1s1j103lo6**** |
The ID of the instance. You can call the DescribeDBInstances operation to query the IDs of instances. |
MetricsConfig | String | Yes | os.cpu_usage.sys.avg,os.cpu_usage.user.avg |
The keys of the Enhanced Monitoring metrics that you want to display for the instance. You can enter a maximum of 30 metric keys. If you enter multiple metric keys, you must separate the metric keys with commas (,). You can call the DescribeAvailableMetrics operation to query the keys of metrics. |
Scope | String | Yes | instance |
The application scope of this modification. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
DBInstanceId | String | pgm-bp1s1j103lo6**** |
The ID of the instance. |
RequestId | String | B55934BB-FFAA-5276-80A8-E0FDB12810B3 |
The ID of the request. |
Scope | String | instance |
The application scope of this modification. Valid values:
|
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=ModifyDBInstanceMetrics
&DBInstanceName=pgm-bp1s1j103lo6****
&MetricsConfig=os.cpu_usage.sys.avg,os.cpu_usage.user.avg
&Scope=instance
&<Common request parameters>
Sample success responses
XML
format
<ModifyDBInstanceMetrics>
<data>
<RequestId>B55934BB-FFAA-5276-80A8-E0FDB12810B3</RequestId>
<Scope>instance</Scope>
<DBInstanceId>pgm-bp1s1j103lo6****</DBInstanceId>
</data>
</ModifyDBInstanceMetrics>
JSON
format
{
"data": {
"RequestId": "B55934BB-FFAA-5276-80A8-E0FDB12810B3",
"Scope": "instance",
"DBInstanceId": "pgm-bp1s1j103lo6****"
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidMetricsConfig | The specified metrics config is invalid. | The error message returned because the Enhanced Monitoring metrics that you specify are invalid. |
400 | InvalidScope | The specified scope is invalid | The error message returned because the application scope that you specify is invalid. |
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.