Adding Monitoring Data
Function
This API is used to add one or more pieces of metric monitoring data. Constraints
-
The size of a POST request cannot exceed 512 KB. Otherwise, the request will be denied.
-
The period for sending POST requests must be shorter than the minimum aggregation period. Otherwise, the aggregated data will be noncontinuous. For example, if the aggregation period is 5 minutes and the POST request sending period is 7 minutes, the data will be aggregated every 10 minutes, rather than 5 minutes.
-
The collect_time value in the POST request body must fall between three days before and 10 minutes after the current time. Otherwise, metric data cannot be added.
-
Cloud Eye discards metric data if the gap between collect_time and the metric reporting time (time when the metric reporting API is called) exceeds 10 minutes during aggregation. You can view only the raw metric data of the last two days. The delayed metric data will not be displayed in the aggregated data. For example, if the Cloud Eye API is called at 14:20:00 to report data and the value of collect_time in the request body is 14:05:00, the reporting is delayed by 15 minutes.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
ces:metricData:create
Write
-
-
-
-
URI
POST /V1.0/{project_id}/metric-data
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID. Constraints N/A Range 1 to 64 characters. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| [items] | Yes | Array of CreateMetricDataRequestBody objects | Request parameter for adding one or more pieces of custom metric data. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| metric | Yes | MetricInfo object | Definition: Metric data. Constraints: N/A |
| ttl | Yes | Integer | Definition: Data validity period, in seconds. If the validity period expires, data will be automatically deleted. Constraints: N/A Range: The value is an integer ranging from 1 to 604800. Default Value: N/A |
| collect_time | Yes | Long | Definition: Time when the data was collected. The value is a UNIX timestamp in milliseconds. Constraints: N/A Range: 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 + 10s, Current time + 10 mins – 10s]. In this way, the data will be inserted to the database without being affected by the latency. Default Value: N/A |
| value | Yes | Double | Definition: Value of the monitored metric data to be added. Constraints: N/A Range: The value can be an integer or a floating point number. Default Value: N/A |
| unit | No | String | Definition: Data unit. Constraints: N/A Range: [0,32] Default Value: N/A |
| type | No | String | Definition: Data type. Constraints: N/A Range: The value can be: Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| namespace | Yes | String | Definition Service namespace, for example, the namespace of ECS is SYS.ECS . For details about service namespaces, see Services Interconnected with Cloud Eye. Constraints N/A Range The value is in the format of service.item, where service and item are separated by a period (.). service and item each must start with a letter. They can contain letters, digits, and underscores (_) and allow 3 to 32 characters. Default Value N/A |
| metric_name | Yes | String | Definition Metric ID. For example, if the metric of an ECS is CPU usage, metric_name is cpu_util . For details about the metric names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Constraints N/A Range The value must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-). For example, the ECS metric cpu_util indicates the CPU usage of an ECS. The DDS metric mongo001_command_ps indicates the command execution frequency. It allows 1 to 96 characters. Default Value N/A |
| dimensions | Yes | Array of MetricsDimension objects | Definition Metric dimension. Constraints 1 to 4 metric dimension objects. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition Dimension of a resource. For example, the dimension of an ECS is instance_id . A maximum of four dimensions are supported. For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Constraints N/A Range The value starts with a letter and allows 1 to 32 characters. It can contain only letters, digits, underscores (_), and hyphens (-). Default Value N/A |
| value | Yes | String | Definition Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Constraints N/A Range 1 to 256 characters Default Value N/A |
Response Parameters
Status code: 201
Created
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| - | String | Request error. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| - | String | The authentication information is not provided or is incorrect. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| - | String | Access to the requested page is forbidden. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| - | String | The request timed out. |
Status code: 429
| Parameter | Type | Description |
|---|---|---|
| - | String | Too many requests. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| - | String | Failed to complete the request because of an internal service error. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| - | String | The system is currently unavailable. |
Example Requests
[ {
"metric" : {
"namespace" : "MINE.APP",
"dimensions" : [ {
"name" : "instance_id",
"value" : "33328f02-3814-422e-b688-bfdba93d4050"
} ],
"metric_name" : "cpu_util"
},
"ttl" : 172800,
"collect_time" : 1463598260000,
"value" : 60,
"unit" : "%"
}, {
"metric" : {
"namespace" : "MINE.APP",
"dimensions" : [ {
"name" : "instance_id",
"value" : "33328f02-3814-422e-b688-bfdba93d4050"
} ],
"metric_name" : "cpu_util"
},
"ttl" : 172800,
"collect_time" : 1463598270000,
"value" : 70,
"unit" : "%"
} ] Example Responses
None
Status Codes
| Status Code | Description |
|---|---|
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 408 | Request Timeout |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot