CreateInstantSiteMonitor

Updated at:

Creates a one-time detection task.

Operation description

Only Alibaba Cloud accounts that have activated Network Analysis and Monitoring can create one-time detection tasks.

This topic provides an example on how to create a one-time detection task. The name of the detection task is task1, the detection address is http://www.aliyun.com, the detection type is HTTP, and the number of detection points is 1.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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 detection task.

http://www.aliyun.com

TaskType

string

Yes

The type of the detection task. Valid values: HTTP, PING, TCP, UDP, and DNS.

HTTP

TaskName

string

Yes

The name of the detection task.

The name must be 4 to 100 characters in length and can contain letters, digits, underscores (_), and Chinese characters.

task1

IspCities

string

No

The information about the detection points. If this parameter is left empty, the system randomly selects three detection points.

The value is a JSON array. Example: [{"city":"546","isp":"465", "type":"IDC"},{"city":"572","isp":"465", "type":"LASTMILE"},{"city":"738","isp":"465"}], which correspond to Beijing, Hangzhou, and Qingdao.

type indicates the type of the detection point. When AgentGroup is set to PC, valid values are IDC and LASTMILE. IDC indicates a detection point deployed in a data center. LASTMILE indicates a detection point deployed in a residential area that uses a fixed broadband network. type is optional and defaults to IDC. When AgentGroup is set to MOBILE, you do not need to specify type.

For more information about how to obtain detection point information, see DescribeSiteMonitorISPCityList.

Note

You must specify either IspCities or RandomIspCity.

[{"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}]

OptionsJson

string

No

The advanced extension options for the protocol type of the detection task. Different protocol types correspond to different extension options.

{"time_out":5000}

RandomIspCity

integer

No

The number of detection points.

Note
  • You must specify either IspCities or RandomIspCity. - If you specify RandomIspCity, IspCities automatically becomes invalid.

1

AgentGroup

string

No

The type of the detection point. Valid values: PC and MOBILE. PC indicates a fixed broadband detection point. MOBILE indicates a mobile detection point. Default value: PC.

Valid values:

  • PC :

    Fixed broadband detection point.

  • MOBILE :

    Mobile detection point.

PC

Advanced metric description for TaskType

The following tables describe the Settings for the advanced parameters of HTTP, PING, TCP, UDP, and DNS in TaskType.

  • HTTP

ParameterTypeDescription
http_methodStringThe HTTP request method. Valid values: GET, POST, and HEAD. Default value: GET.
headerStringThe custom HTTP headers separated by line breaks (\n).
The format of each header must comply with the HTTP protocol, which uses key-value pairs separated by half-width colons.

cookieStringThe cookie. The format is the same as the standard HTTP request cookie.
request_contentStringThe request content. Valid formats: JSON and form. If this parameter is not specified, the request does not contain a body.
response_contentStringThe expected response content. During detection, the first 64 bytes returned by the HTTP server are checked.
match_ruleStringThe match rule. A value of 0 indicates that the detection is successful if the response does not contain response_content.
A value of 1 indicates that the detection is successful if the response contains response_content.

usernameStringThe username. If a username is provided, the BasicAuth header is included in the HTTP request.
passwordStringThe password for HTTP request authentication.
time_outintThe timeout period. Unit: milliseconds. Default value: 30000.
max_redirectintThe maximum number of redirects. The default value is 5 for ECS probes and 2 for carrier probes.
To disable redirects, set this parameter to 0.
Valid values: 0 to 50.




  • PING

ParameterTypeDescription
failure_rateintThe failure rate threshold. If the PING failure rate exceeds this value, the detection is failed and returns 610 (PingAllFail) or 615 (PingPartialFail).
Default value: 0.1.

ping_numintThe number of PING requests. Default value: 20.
Valid values: 1 to 100.

  • TCP or UDP

ParameterTypeDescription
portintThe port of the TCP or UDP server.
request_contentstringThe request content. When request_format is set to hex, request_content is in hexadecimal compact format.
request_formatstringThe request format. When request_format is set to a value other than hex, request_content is sent to the TCP or UDP server as a plain string.
response_contentstringThe 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, response_content is in hexadecimal compact format.
When response_format is set to a value other than hex, response_content is a plain string.




  • DNS

ParameterTypeDescription
dns_serverstringThe address of the DNS server, which can be a domain name or an IP address.
dns_typestringThe DNS query type. Valid values: A, NS, CNAME, MX, TXT, and ANY.
expect_valuestringThe list of expected values separated by whitespace characters.
match_rulestringThe relationship between the expected value list and the DNS record list. If the specified relationship is not met, the detection is failed.
An empty string or IN_DNS: The expected value list is a subset of the DNS record list.
DNS_IN: The DNS record list is a subset of the expected value list.
EQUAL: The DNS record list is equal to the expected value list.
ANY: The DNS record 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 is successful. Valid values:

  • true: Successful.

  • false: Failed.

true

CreateResultList

array<object>

The list of results for creating the one-time detection task.

object

The list of results for creating the one-time detection task.

TaskId

string

The ID of the detection task.

2c8dbdf9-a3ab-46a1-85a4-f094965e****

TaskName

string

The name of the detection 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.