Adding Monitoring Data
Function
This API is used to add one or more monitoring data records to a server.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/ams/report/metricdata
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID, which can be obtained from the console or by calling an API. For details, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token obtained from IAM. For details, see Obtaining a Token. |
Content-Type |
Yes |
String |
Message body type or format. Content type, which is application/json. Enumeration values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
[items] |
Yes |
Array of MetricDataItem objects |
Monitoring data items to be added. |
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 30 minutes. Example: 2024-10-16 16:03:01 needs to be converted to Unix timestamp 1702759381000 using a tool. 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. To query the metric dimension list, call the API Querying Time Series Objects. A maximum of 50 dimensions are supported. Each dimension is in JSON format. |
namespace |
Yes |
String |
Metric namespace. To query metric namespaces, call the API Querying Tag Values. To use a custom namespace, ensure that: It cannot contain colons (:). It must be in the format of "service.item". The value must contain 3 to 32 characters starting with a letter. Only letters, digits, and underscores (_) are allowed. In addition, "service" cannot be "PAAS". |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Name of the custom metric dimension. Length: 1 to 32 characters. |
value |
Yes |
String |
Value of the custom metric dimension. Length: 1 to 64 characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
metric_name |
Yes |
String |
Metric name. Length: 1 to 255 characters. |
type |
No |
String |
Metric data type.
Enumeration values:
|
unit |
No |
String |
Data unit. Length: up to 32 characters. |
value |
Yes |
Double |
Metric value. Value range: valid numeral type. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Response code. |
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
OK: The request is successful.
{ "errorCode" : "SVCSTG_AMS_2000000", "errorMessage" : "success" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK: The request is successful. |
400 |
Bad Request: The request is invalid. The client should not repeat the request without modifications. |
401 |
Unauthorized: The authentication information is incorrect or invalid. |
403 |
Forbidden: The request is rejected. The server has received the request and understood it, but the server refuses to respond to it. The client should not repeat the request without modifications. |
500 |
Internal Server Error: The server is able to receive the request but unable to understand the request. |
503 |
Service Unavailable: The requested service is invalid. The client should not repeat the request without modifications. |
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