All Products
Search
Document Center

CloudMonitor:PutCustomMetric

Last Updated:Mar 01, 2024

Operation description

Note We recommend that you call the PutHybridMonitorMetricData operation of Hybrid Cloud Monitoring to report monitoring data.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
MetricListobject []Yes
TypestringYes

The type of the reported data. Valid values of N: 1 to 21. Valid values:

  • 0: reports raw data
  • 1: reports aggregate data
Note We recommend that you report aggregate data in both the aggregation periods of 60s and 300s. Otherwise, you cannot query monitoring data in a time span that is more than seven days.
0
MetricNamestringYes

The name of the metric. Valid values of N: 1 to 21. For more information, see Appendix 1: Metrics.

cpu_total
TimestringNo

The timestamp when the metric data is generated. Valid values of N: 1 to 21. The timestamp can be in one of the following formats:

  • The UTC timestamp that is in the YYYY-MM-DDThh:mm:ssZ format. Example: 20171012T132456.888+0800.
  • The UNIX timestamp of the LONG type. Example: 1508136760000.
1508136760000
GroupIdstringYes

The ID of the application group. Valid values of N: 1 to 21.

Note If the metric does not belong to any application group, enter 0.
12345
ValuesstringYes

The collection of metric values. Valid values of N: 1 to 21.

Note If the MetricList.N.Type parameter is set to 0, the keys in this parameter must be set to the specified value. CloudMonitor aggregates raw data in each aggregation period to generate multiple statistical values, such as the maximum value, the count, and the total value.
{"value":10.5}
DimensionsstringYes

The dimensions that specify the resources whose monitoring data you want to query. Valid values of N: 1 to 21.

Set the value to a collection of key-value pairs. Format:{"Key":"Value"}.

The key or value must be 1 to 64 bytes in length. Excessive characters are truncated.

The key or value can contain letters, digits, periods (.), hyphens (-), underscores (_), forward slashes (/), and backslashes (\).

Note Dimensions must be formatted as a JSON string in a specified order.
{"sampleName1":"value1","sampleName2":"value2"}
PeriodstringNo

The aggregation period. Valid values of N: 1 to 21. Unit: seconds. Valid values: 60 and 300.

Note If the MetricList.N.Type parameter is set to 1, the MetricList.N.Period parameter is required.
60

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The HTTP status code.

Note The status code 200 indicates that the call was successful.
200
Messagestring

The error message.

The request has failed due to a temporary failure of the server.
RequestIdstring

The ID of the request.

05B36C2C-5F6E-48D5-8B41-CE36DD7EE8E0

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "Message": "The request has failed due to a temporary failure of the server.",
  "RequestId": "05B36C2C-5F6E-48D5-8B41-CE36DD7EE8E0"
}

Error codes

HTTP status codeError codeError message
400%s%s
500InternalError%s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history