Creates a one-time synthetic monitoring task.
Operation description
Only Alibaba Cloud accounts that have activated Network Analysis and Monitoring can create one-time synthetic monitoring tasks.
This topic provides an example of how to create a one-time synthetic monitoring task. The task name is task1, the monitored address is http://www.aliyun.com, the task type is HTTP, and the number of detection points is 1.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:CreateInstantSiteMonitor |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Address |
string |
Yes |
The URL or IP address of the synthetic monitoring task. |
http://www.aliyun.com |
| TaskType |
string |
Yes |
The type of the synthetic monitoring task. Valid values: HTTP, PING, TCP, UDP, and DNS. |
HTTP |
| TaskName |
string |
Yes |
The name of the synthetic monitoring task. The name must be 4 to 100 characters in length and can contain letters, digits, and underscores (_). |
task1 |
| IspCities |
string |
No |
The detection point information. If this parameter is left empty, the system randomly selects three detection points. The value is in The type field specifies the detection point type. When AgentGroup is set to PC, valid values are IDC and LASTMILE. IDC indicates detection points deployed in data centers. LASTMILE indicates detection points deployed in end-user homes that use fixed-line networks. The type field is optional and defaults to IDC. When AgentGroup is set to MOBILE, this field does not need to be specified. For information about how to obtain detection point information, see DescribeSiteMonitorISPCityList. Note
You must specify either |
[{"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}] |
| OptionsJson |
string |
No |
The advanced extended options for the protocol type of the synthetic monitoring task. Different protocol types correspond to different extended options. |
{"time_out":5000} |
| RandomIspCity |
integer |
No |
The number of detection points. Note
|
1 |
| AgentGroup |
string |
No |
The type of detection points. Valid values: PC and MOBILE. PC indicates fixed-line network detection points. MOBILE indicates mobile network detection points. Default value: PC. Valid values:
|
PC |
Advanced parameter settings for TaskType
The following tables describe how to configure the advanced parameters for HTTP, PING, TCP, UDP, and DNS in TaskType.
HTTP
| Parameter | Type | Description |
| http_method | String | The HTTP request method. Valid values: GET, POST, and HEAD. Default value: GET. |
| header | String | Custom HTTP headers separated by line breaks (\n). Each header line must conform to the HTTP protocol format (key-value pairs separated by a half-width colon). |
| cookie | String | The cookie, written in the standard HTTP request format. |
| request_content | String | The request content. Two formats are supported: JSON and form. If not provided, the request does not contain a body. |
| response_content | String | The expected response content. During detection, the first 64 bytes returned by the HTTP server are checked. |
| match_rule | String | 0: The detection succeeds if the response does not contain response_content. 1: The detection succeeds if the response contains response_content. |
| username | String | If a username is provided, a BasicAuth header is included in the HTTP request. |
| password | String | The password for HTTP request authentication. |
| time_out | int | The timeout period. Unit: milliseconds. Default value: 30000. |
| max_redirect | int | The maximum number of redirects. The default value is 5 for ECS probes and 2 for carrier detection points. Set this parameter to 0 to disable redirects. Valid values: 0 to 50. |
PING
| Parameter | Type | Description |
| failure_rate | int | If the PING failure rate exceeds this value, the detection is failed and returns 610 (PingAllFail) or 615 (PingPartialFail). Default value: 0.1. |
| ping_num | int | The number of PING attempts. Default value: 20. Valid values: 1 to 100. |
TCP or UDP
| Parameter | Type | Description |
| port | int | The port of the TCP or UDP server. |
| request_content | string | The request content. When request_format is set to hex, the request_content value is in hexadecimal compact format. |
| request_format | string | When request_format is set to other values, request_content is sent to the TCP or UDP server as a plain character string. |
| response_content | string | The response content. If the content returned by the TCP or UDP server does not contain response_content, the detection is failed. When response_format is set to hex, the response_content value is in hexadecimal compact format. When response_content is set to other values, response_content is a plain character string. |
DNS
| Parameter | Type | Description |
| dns_server | string | The DNS server address, which can be a domain name or an IP address. |
| dns_type | string | The DNS query type. Valid values: A, NS, CNAME, MX, TXT, and ANY. |
| expect_value | string | The list of expected values separated by whitespace characters. |
| match_rule | string | The relationship between the expected value list and the DNS list. If the specified relationship is not met, the detection is failed. Empty string or IN_DNS: The expected value list is a subset of the DNS list. DNS_IN: The DNS list is a subset of the expected value list. EQUAL: The DNS list is equal to the expected value list. ANY: The DNS list and the expected value list have a non-empty intersection. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The status code. Note
A value of 200 indicates success. |
200 |
| Message |
string |
The returned message. |
successful |
| RequestId |
string |
The request ID. |
68192f5d-0d45-4b98-9724-892813f86c71 |
| Success |
string |
Indicates whether the operation was successful. Valid values:
|
true |
| CreateResultList |
array<object> |
The result list of the one-time synthetic monitoring task creation. |
|
|
object |
The result list of the one-time synthetic monitoring task creation. |
||
| TaskId |
string |
The ID of the synthetic monitoring task. |
2c8dbdf9-a3ab-46a1-85a4-f094965e**** |
| TaskName |
string |
The name of the synthetic monitoring task. |
task1 |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "successful",
"RequestId": "68192f5d-0d45-4b98-9724-892813f86c71",
"Success": "true",
"CreateResultList": [
{
"TaskId": "2c8dbdf9-a3ab-46a1-85a4-f094965e****",
"TaskName": "task1"
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidQueryParameter | %s | |
| 400 | IllegalAddress | Illegal HTTP address | |
| 400 | OperationError | Operation failed | |
| 400 | TaskNotExists | Task does not exist | |
| 400 | OperatorInvalid | Operator invalid | |
| 400 | OperatorCityInvalid | Operator City invalid | |
| 400 | NameRepeat | Task name repeat | |
| 400 | CreateAlarmError | Create alarm error | |
| 400 | NameNotExists | Task name not exists | |
| 400 | Illegal Task Name | The task name of the sitemonitor task is illegal. | Site monitoring task name is illegal. |
| 401 | AccessDeniedException | You donot have sufficient access to perform this action. | |
| 500 | InternalError | %s | |
| 402 | LimitExceeded | The quota for this customer had been reached. | |
| 403 | %s | %s | |
| 403 | Forbidden | %s | |
| 503 | %s | %s | |
| 406 | ExceedingQuota | Exceeding quota limits. | The number of tasks exceeds the limit |
| 409 | %s | %s |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.