Reviewed-by: gtema <artem.goncharov@gmail.com> Reviewed-by: Kucerak, Kristian <kristian.kucerak@t-systems.com> Co-authored-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-committed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
31 KiB
Adding Monitoring Data
Function
This API is used to add one or more monitoring data records to a server.
Request
Request parameters
Table 2 describes the request parameters.
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
metric |
Yes |
JSON object |
See Table 3. |
Metric data. |
values |
Yes |
JSON array |
See Table 4. |
- |
collect_time |
Yes |
UNIX timestamp |
UNIX timestamp, in ms. |
Data collection time, which must meet the following requirement: Current UTC time – Data collection time ≤ 24 hours, or Data collection time – Current UTC time ≤ 30 minutes |
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
namespace |
Yes |
String |
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 start with PAAS or SYS. |
Metric namespace. |
dimensions |
Yes |
JSON array |
Each dimension is a JSON object, and its structure is as follows: dimension.name: 1–32 characters. dimension.value: 1–64 characters. |
List of metric dimensions. |
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
unit |
No |
String |
- |
Data unit. |
metric_name |
Yes |
String |
- |
Metric name. |
type |
No |
String |
Integer or floating number |
Data type. |
value |
Yes |
Floating number |
Valid numeral type. |
Metric value. |
Request headers
Table 5 describes the request headers.
Name |
Mandatory |
Description |
---|---|---|
X-Auth-Token |
Yes |
User token obtained from IAM. |
Content-Type |
Yes |
Content type, which is application/json. |
Example request
[ { "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 } ]
Response
Response parameters
Table 6 describes the response parameters.
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Response code. |
errorMessage |
String |
Response message. |
Example response
{ "errorCode": "AOM.0200", "errorMessage": "success" }
Status Code
- Success response
Table 7 describes the status code.
- Error response
Table 8 describes the status codes. For more information, see Status Codes.
Table 8 Status codes Status Code
Message
Description
400
Bad Request
The request is invalid.
The client should not repeat the request without modifications.
401
Unauthorized
The authorization information provided by the client is incorrect or invalid.
403
Forbidden
The request is rejected.
The server has received the request and understood it, but the server is refusing 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 Code
Error Code |
Message |
Solution |
---|---|---|
AOM.0001 |
Invalid request parameter. |
Check whether the parameter meets requirements. |
AOM.0002 |
Invalid namespace. |
Check whether the parameter meets requirements. |
AOM.0003 |
Dimensions are left blank. |
Check whether the parameter meets requirements. |
AOM.0005 |
Invalid metric data type. |
Check whether the parameter meets requirements. |
AOM.0006 |
The metric data value is left blank. |
Check whether the parameter meets requirements. |
AOM.0007 |
Invalid name or value length in the dimension. |
Check whether the parameter meets requirements. |
AOM.0008 |
The request exceeds 40 KB. |
Check whether the parameter meets requirements. |
AOM.0009 |
A metric supports a maximum of 20 dimensions. |
Check whether the parameter meets requirements. |
AOM.0010 |
Invalid collection time. |
Check whether the parameter meets requirements. |
AOM.0500 |
Internal server error. |
Contact technical support. |