This API is used to modify a threshold rule.
PUT /v2/{project_id}/ams/alarms
Request parameters
Table 1 describes the request parameters.
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
project_id |
Yes |
String |
- |
Project ID obtained from IAM. Generally, a project ID contains 32 characters. |
statistic |
Yes |
String |
maximum, minimum, average, sum, or sampleCount. |
Statistic. |
namespace |
Yes |
String |
1–255 characters. Colons (:) are not allowed. |
Namespace. The value transferred to the backend when a threshold rule is added will be used. The value transferred here will not replace that value. |
metricName |
Yes |
String |
1–255 characters. |
Metric name. The value transferred to the backend when a threshold rule is added will be used. The value transferred here will not replace that value. |
period |
Yes |
Integer |
20000, 60000, 300000, 900000, 1800000, 3600000, 14400000, or 86400000 |
Statistical period. |
alarmLevel |
No |
Integer |
4, 3, 2, or 1 |
Alarm severity. |
evaluationPeriods |
Yes |
Integer |
4, 3, or 2 |
Number of consecutive periods. |
comparisonOperator |
Yes |
String |
>, >=, <, or <= |
Comparison operator. |
threshold |
Yes |
String |
Non-null value that can be converted to a value of the double type. Once converted, the value cannot be null, or be a positive or negative infinity. |
Threshold. |
alarmName |
Yes |
String |
1–255 characters. Special characters are not allowed. |
Threshold name. |
dimensions |
Yes |
List |
Non-null; size < 100 |
Metric dimension. The value transferred to the backend when a threshold rule is added will be used. The value transferred here will not replace that value. |
unit |
No |
String |
Number of characters < 32 |
Metric unit. The value transferred to the backend when a threshold rule is added will be used. The value transferred here will not replace that value. |
actionEnabled |
No |
Boolean |
- |
Whether to enable the alarm function. |
alarmActions |
No |
Array |
Size ≤ 5 |
Alarm action. |
alarmAdvice |
No |
String |
Number of characters < 255 |
Alarm suggestion. Leave this parameter blank. |
alarmDescription |
No |
String |
Number of characters < 255 |
Threshold rule description. |
insufficientDataActions |
No |
Array |
Size ≤ 5 |
Action to be taken when data is insufficient. |
okActions |
No |
Array |
Size ≤ 5 |
Recovery action. |
Request headers
Table 2 describes the request headers.
Example request
{ "actionEnabled": false, "alarmActions": [], "alarmAdvice": "", "alarmDescription": "", "alarmLevel": 3, "alarmName": "aaaaaaaa", "comparisonOperator": ">=", "dimensions": [ { "name": "appName", "value": "rhm-broker" } ], "evaluationPeriods": 1, "insufficientDataActions": [], "metricName": "cpuCoreLimit", "namespace": "PAAS.CONTAINER", "okActions": [], "period": 60000, "statistic": "average", "threshold": 0, "unit": "Core" }
Response parameters
Table 3 describes the response parameters.
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Response code. |
errorMessage |
String |
Response message. |
alarmId |
Long |
Threshold rule code. |
Example response
{ "errorCode": "AOM.0200", "errorMessage": "success", "alarmId": 12345678 }
Table 4 describes the status code.
Table 5 describes the status codes. For more information, see 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 |
Message |
Solution |
---|---|---|
AOM.0101 |
Invalid alarm name. |
Check whether the parameter meets requirements. |
AOM.0102 |
The threshold rule name already exists. |
Use another name. |
AOM.0103 |
Invalid alarm description. |
Check whether the parameter meets requirements. |
AOM.0104 |
Invalid alarm threshold. |
Check whether the parameter meets requirements. |
AOM.0105 |
Invalid alarm period. |
Check whether the parameter meets requirements. |
AOM.0106 |
Invalid email list. |
Check whether the parameter meets requirements. |
AOM.0107 |
The maximum number of threshold rules has been reached. |
Contact technical support to expand the capacity. |
AOM.0108 |
Invalid time range for alarm queries. |
Check whether the parameter meets requirements. |
AOM.0109 |
Invalid project ID. |
Check whether the parameter meets requirements. |
AOM.0115 |
Invalid request parameter. |
Check whether the parameter meets requirements. |
AOM.0118 |
Invalid number of consecutive periods. |
Check whether the parameter meets requirements. |
AOM.0119 |
Invalid alarm statistic. |
Check whether the parameter meets requirements. |
AOM.0120 |
Invalid alarm comparison operator. |
Check whether the parameter meets requirements. |
AOM.0121 |
The alarm does not exist. |
Check whether the threshold rule exists. |
AOM.0500 |
Internal server error. |
Contact technical support. |