This API is used to add one or more pieces of custom metric monitoring data to solve the problem that the system metrics cannot meet specific service requirements.
For details about the monitoring data retention period, see How Long Is Metric Data Retained? in Cloud Eye User Guide.
POST /V1.0/{project_id}/metric-data
Parameter |
Mandatory |
Description |
|---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Minimum: 1 Maximum: 64 Regular expression matching: ^[a-zA-Z0-9-]{1,64}$ |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
Array elements |
Array of objects |
Yes |
Specifies whether to add one or more pieces of custom metric monitoring data. For details, see Table 3. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
metric |
Yes |
Object |
Specifies the metric data. For details, see Table 4. |
ttl |
Yes |
Integer |
Specifies the data validity period. The unit is second. Supported range: 1 to 604800 If the validity period expires, the data will be automatically deleted. |
collect_time |
Yes |
Long |
Specifies when the data was collected. The value is a UNIX timestamp, in milliseconds. NOTE:
Since there is a latency between the client and the server, the timestamp when data was inserted must be within the time range [Current time – 3d + 20s, Current time + 10 mins – 20s]. In this way, the data will be inserted to the database without being affected by the latency. |
value |
Yes |
Double |
Specifies the monitoring metric data to be added, which can be an integer or a floating point number. |
unit |
No |
String |
Specifies the data unit. The value can contain a maximum of 32 characters. You can set this parameter based on your service needs. Minimum: 0 Maximum: 32 |
type |
No |
String |
Specifies the enumerated type. The value can be:
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
namespace |
Yes |
String |
Specifies the customized namespace. For details, see Services Interconnected with Cloud Eye. The namespace must be in the service.item format and contain 3 to 32 characters. service and item each must start with a letter and contain only letters, digits, and underscores (_). In addition, service cannot start with SYS, AGT, or SRE, and namespace cannot be SERVICE.BMS because this namespace has been used by the system. You can leave this parameter blank when you set alarm_type to (EVENT.SYS| EVENT.CUSTOM). |
dimensions |
Yes |
Array of objects |
Specifies the metric dimension. A maximum of three dimensions are supported. For details, see Table 5. |
metric_name |
Yes |
String |
Specifies the metric ID. For example, if the monitoring metric of an ECS is CPU usage, metric_name is cpu_util. For details, see Services Interconnected with Cloud Eye. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
name |
Yes |
String |
Specifies the monitoring dimension name. For example, the ECS dimension is instance_id. For details about the dimension of each monitored object, see the documentation of a specific cloud service. You can navigate there directly from the Services Interconnected with Cloud Eye page. The value must start with a letter. It allows 1 to 32 characters and can only contain letters, digits, underscores (_), and hyphens (-). |
value |
Yes |
String |
Specifies the dimension value, for example, an ECS ID. The value must start with a letter or digit. It allows 1 to 256 characters and can only contain letters, digits, underscores (_), and hyphens (-). |
[
{
"metric": {
"namespace": "MINE.APP",
"dimensions": [
{
"name": "instance_id",
"value": "6f3c6f91-4b24-4e1b-b7d1-a94ac1cb011d"
}
],
"metric_name": "cpu_util"
},
"ttl": 172800,
"collect_time": 1463598260000,
"type": "float",
"value": 0.09,
"unit": "%"
},
{
"metric": {
"namespace": "MINE.APP",
"dimensions": [
{
"name": "instance_id",
"value": "6f3c6f91-4b24-4e1b-b7d1-a94ac1cb011d"
}
],
"metric_name": "cpu_util"
},
"ttl": 172800,
"collect_time": 1463598270000,
"type": "float",
"value": 0.12,
"unit": "%"
}
]
[
{
"metric": {
"namespace": "SYS.RDS",
"dimensions": [
{
"name": "rds_cluster_id",
"value": "3c8cc15614ab46f5b8743317555e0de2in01"
}
],
"metric_name": "rds021_myisam_buf_usage"
},
"ttl": 172800,
"collect_time": 1463598260000,
"type": "float",
"value": 0.01,
"unit": "Ratio"
}
]
The response has no message body.
Returned Value |
Description |
|---|---|
400 Bad Request |
Request error. |
401 Unauthorized |
The authentication information is not provided or is incorrect. |
403 Forbidden |
Access to the requested page is forbidden. |
408 Request Timeout |
The request timed out. |
429 Too Many Requests |
Concurrent requests are excessive. |
500 Internal Server Error |
Failed to complete the request because of an internal service error. |
503 Service Unavailable |
The service is currently unavailable. |
See Error Codes.