Creates an availability monitoring task.
Operation description
This topic provides an example on how to create an availability monitoring task named task1 with the detection type HTTP in the application group 123456. Alert notifications are sent by email and DingTalk chatbot.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:CreateHostAvailability |
create |
*HostAvailability
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| GroupId |
integer |
Yes |
The application group ID. |
123456 |
| TaskName |
string |
Yes |
The name of the availability monitoring task. The name must be 4 to 100 characters in length and can contain letters, digits, underscores (_), and Chinese characters. |
task1 |
| TaskScope |
string |
No |
The detection scope of the availability monitoring task. Valid values:
|
GROUP |
| TaskType |
string |
Yes |
The detection type of the availability monitoring task. Valid values:
|
HTTP |
| TaskOption.HttpURI |
string |
No |
The URI for HTTP or Telnet detection. |
https://www.aliyun.com telnet://127.0.0.1:80 |
| TaskOption.TelnetOrPingHost |
string |
No |
The domain name or address to detect. Note
If the detection type is PING, set this parameter. |
www.aliyun.com |
| TaskOption.HttpResponseCharset |
string |
No |
The response character set for HTTP detection. Note
Only UTF-8 is supported. |
UTF-8 |
| TaskOption.HttpPostContent |
string |
No |
The POST content of the HTTP detection request. |
params1=paramsValue1 |
| TaskOption.HttpResponseMatchContent |
string |
No |
The content to match in the response. |
ok |
| TaskOption.HttpMethod |
string |
No |
The method for the detection type. Valid values:
Note
If the detection type is HTTP, set this parameter. |
GET |
| TaskOption.HttpNegative |
boolean |
No |
The alert rule for matching HTTP response content. Valid values:
Note
This parameter takes effect only when the detection type is HTTP. |
true |
| TaskOption.HttpHeader |
string |
No |
The header of the HTTP request. The format is |
token:testTokenValue |
| TaskOption.Interval |
integer |
No |
The detection frequency. Unit: seconds. Valid values: 15, 30, 60, 120, 300, 900, 1800, and 3600. Note
Only CloudMonitor agent 3.5.1 or later supports this parameter. |
60 |
| AlertConfig.NotifyType |
integer |
Yes |
The alert notification type. Valid values: 0: email + DingTalk chatbot. |
0 |
| AlertConfig.StartTime |
integer |
No |
The start time when the alert takes effect. Valid values: 0 to 23. For example, if Note
If the alert is not within the effective period, no alert notification is sent even if the threshold is exceeded. |
0 |
| AlertConfig.EndTime |
integer |
No |
The end time when the alert takes effect. Valid values: 0 to 23. For example, if Note
If the alert is not within the effective period, no alert notification is sent even if the threshold is exceeded. |
22 |
| AlertConfig.SilenceTime |
integer |
No |
The mute period. Unit: seconds. Default value: 86400 (1 day). |
86400 |
| AlertConfig.WebHook |
string |
No |
The webhook address. |
https://www.aliyun.com/webhook.json |
| AlertConfigEscalationList |
array<object> |
Yes |
None. |
|
|
object |
No |
None. |
||
| MetricName |
string |
Yes |
The metric for the alert. Valid values of N: 1 to 21. Valid values:
|
HttpStatus |
| Value |
string |
No |
The alert threshold. Valid values of N: 1 to 21. |
90 |
| Times |
integer |
No |
The number of alert retries. Valid values of N: 1 to 21. |
3 |
| Operator |
string |
No |
The comparison operator for the alert rule. Valid values of N: 1 to 21. Valid values:
|
> |
| Aggregate |
string |
No |
The statistical method for the alert. Valid values of N: 1 to 21. The valid values vary based on the metric:
Note
The statistical method for status codes is the original value (Value). The statistical method for latency or packet loss rate is the average value (Average). |
Value |
| InstanceList |
array |
No |
The list of ECS instances that initiate detection. Valid values of N: 1 to 21. Note
Set this parameter when |
i-absdfkwl321**** |
|
string |
No |
The list of ECS instances that initiate detection. Valid values of N: 1 to 21. Note
Set this parameter when |
2 |
|
| AlertConfigTargetList |
array<object> |
No |
The alert trigger targets. |
|
|
object |
No |
The alert trigger targets. |
||
| Id |
string |
No |
The ID of the alert trigger target. |
1 |
| Arn |
string |
No |
The resource ARN. Format:
|
acs:mns:cn-hangzhou:120886317861****:/queues/test/message |
| Level |
string |
No |
The alert level. Valid values:
|
["INFO", "WARN", "CRITICAL"] |
| JsonParams |
string |
No |
The JSON-formatted parameters of the alert callback. |
{"customField1":"value1","customField2":"$.name"} |
For more information about common request parameters, see Common parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The status code. Note
200 indicates success. |
200 |
| Message |
string |
The error message. |
The specified resource is not found. |
| RequestId |
string |
The request ID. |
ACBDBB40-DFB6-4F4C-8957-51FFB233969C |
| TaskId |
integer |
The ID of the availability monitoring task. |
12345 |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "The specified resource is not found.",
"RequestId": "ACBDBB40-DFB6-4F4C-8957-51FFB233969C",
"TaskId": 12345,
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ParameterInvalid | Parameter invalid. | The parameter is invalid. |
| 412 | ResouceOverLimit | The task over limit | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | AccessForbidden | User not authorized to operate on the specified resource. | |
| 404 | ResourceNotFound | %s | |
| 409 | ResourceConflict | Concurrent modification of resources. | |
| 409 | ResourceExist | Resources already exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.