Adding Monitoring Data
Function
This API is used to add one or more monitoring data records to a server.
URI
POST /v1/{project_id}/ams/report/metricdata
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID obtained from IAM. Generally, a project ID contains 32 characters. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token obtained from IAM. |
| Content-Type | Yes | String | Content type, which is application/json. Enumeration values:
|
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| [items] | Yes | Array of MetricDataItem objects | Metric parameters. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| collect_time | Yes | Long | Data collection time (UNIX timestamp, in ms), which ranges from the last 24 hours to the next 0.5 hour. The following requirement needs to be met: Current UTC time – Data collection time ≤ 24 hours, or Data collection time – Current UTC time ≤ 30 minutes If the data reporting time is earlier than 08:00 of the current day, only the data generated after 08:00 of the current day is displayed on the metric monitoring page. |
| metric | Yes | MetricItemInfo object | Metric details. |
| values | Yes | Array of ValueData objects | Metric value. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| dimensions | Yes | Array of Dimension2 objects | List of metric dimensions. Each dimension is a JSON object composed of the following: dimension.name: 1–32 characters. dimension.value: 1–64 characters. |
| namespace | Yes | String | Metric namespace, which must be in the format of service.item. The value must be 3 to 32 characters starting with a letter. Only letters, digits, and underscores (_) are allowed. In addition, service cannot be PAAS. Minimum: 3 Maximum: 32 |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Response code. Minimum: 12 Maximum: 12 |
| errorMessage | String | Response message. |
Example Requests
Add a piece of monitoring data to the server. (In the following example, set "collect_time" to the latest timestamp.)
https://{Endpoint}/v1/{project_id}/ams/report/metricdata
[ {
"metric" : {
"namespace" : "NOPAAS.ESC",
"dimensions" : [ {
"name" : "instance_id",
"value" : "instance-101"
} ]
},
"values" : [ {
"unit" : "percent",
"metric_name" : "cpu_util",
"type" : "int",
"value" : 35
} ],
"collect_time" : 1467787152000
} ] Example Responses
Status code: 200
The request is successful.
{
"errorCode" : "SVCSTR.ALS.200200",
"errorMessage" : "success"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | The request is successful. |
| 400 | Invalid request. |
| 401 | Invalid authentication information. |
| 403 | The request is rejected. |
| 500 | The server is able to receive the request, but the request is improper. |
| 503 | The service is unavailable. |
Error Codes
See Error Codes.
Last Article: Querying Monitoring Data
Next Article: Adding or Modifying One or More Service Discovery Rules
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.