All Products
Search
Document Center

CloudMonitor:CreateInstantSiteMonitor

Last Updated:Jul 26, 2024

Creates an instant test task.

Operation description

You can create an instant test task only by using the Alibaba Cloud account that you used to enable Network Analysis and Monitoring.

This topic provides an example to show how to create an instant test task. The name of the task is task1. The tested address is http://www.aliyun.com. The test type is HTTP. The number of detection points is 1.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cms:CreateInstantSiteMonitorcreate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
AddressstringYes

The URL or IP address that you want to test.

http://www.aliyun.com
TaskTypestringYes

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

HTTP
TaskNamestringYes

The name of the instant test task.

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

task1
IspCitiesstringNo

The detection points. If you leave this parameter empty, the system randomly selects three detection points.

The value is a JSON array. Example: {"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}. The values of the city field indicate Beijing, Hangzhou, and Qingdao.

For information about how to obtain detection points, see DescribeSiteMonitorISPCityList .

Note You must specify one of the IspCities and RandomIspCity parameters.
[{"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}]
OptionsJsonstringNo

The extended options of the protocol that is used by the instant test task. The options vary based on the protocol.

{"time_out":5000}
RandomIspCityintegerNo

The number of detection points.

Note
  • You must specify one of the IspCities and RandomIspCity parameters. If you specify the RandomIspCity parameter, the IspCities parameter automatically becomes invalid.
1

Extended options of the TaskType parameter

The following tables describe the extended options of the HTTP, PING, TCP, UDP, and DNS protocols specified by the TaskType parameter.

  • HTTP
ParameterTypeDescription
http_methodStringThe HTTP request method. Valid values: GET, POST, and HEAD. Default value: GET.
headerStringThe custom HTTP headers that are separated by line feeds (\n).Each header must comply with the HTTP protocol. Each header must be a key-value pair in which the key and value are separated by a colon (:).
cookieStringThe HTTP cookie that is specified in compliance with the HTTP request standard.
request_contentStringThe content of the request. The content can be in the JSON or form format. If this parameter is not specified, the request body is empty.
response_contentStringThe expected content of the response. The first 64 bytes of the content returned by the HTTP server are checked during instant test.
match_ruleString0: If the response does not contain the content specified by the response_content parameter, the detection is successful.The value 1 indicates that the detection is successful if the response contains the content specified by the response_content parameter.
usernameStringIf the username parameter is specified, the HTTP request contains the basic authentication header.
passwordStringThe password that is used to authenticate the HTTP request.
time_outintThe timeout period. Unit: milliseconds. Default value: 5.
max_redirectintThe maximum number of redirections. The default value is 5 for a detection point that is running on an Elastic Compute Service (ECS) instance and 2 for a detection point that is provided by a carrier.To disable redirections, set the value to 0.Valid values: 0 to 50.
  • PING
ParameterTypeDescription
failure_rateintIf the rate of the failed pings exceeds the value of this parameter, the detection fails and the status code 610 or 615 is returned. The error message of the status code 610 is PingAllFail and the error message of the status code 615 is PingPartialFail.Default value: 0.1.
ping_numintThe number of times that the monitored address is pinged. Default value: 20.Valid values: 1 to 100.
  • TCP or UDP
ParameterTypeDescription
portintThe port number of the TCP or UDP server.
request_contentstringThe content of the request. If the request_format parameter is set to hex, the value of the request_content parameter is parsed in the hexadecimal format.
request_formatstringIf the request_format parameter is set to another value, the value of the request_content parameter is sent to the TCP or UDP server as a regular string.
response_contentstringThe content of the response. If the response from the TCP or UDP server does not contain the content specified by the response_content parameter, the detection fails. If the response_format parameter is set to hex, the value of the response_format parameter is parsed in the hexadecimal format. If the response_format parameter is set to another value, the value of the response_content parameter is parsed as a regular string.
  • DNS
ParameterTypeDescription
dns_serverstringThe domain name or IP address of the Domain Name System (DNS) server.
dns_typestringThe type of the DNS records to query. Valid values: A, NS, CNAME, MX, TXT, and ANY.
expect_valuestringThe list of expected values. Separate the expected values with space characters.
match_rulestringThe relationship between the list of expected values and the list of DNS results. If the two lists do not meet the specified relationship, the detection fails. Valid values:Empty string or IN_DNS: The list of expected values is a subset of the list of DNS results.DNS_IN: The list of DNS results is a subset of the list of expected values.EQUAL: The list of DNS results is the same as the list of expected values.ANY: The list of DNS results intersects with the list of expected values.

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The error code.

Note The status code 200 indicates that the call was successful.
200
Messagestring

The returned message.

successful
RequestIdstring

The ID of the request.

68192f5d-0d45-4b98-9724-892813f86c71
Successstring

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
true
CreateResultListarray<object>

The results for creating the instant test task.

object

The ID of the instant test task.

TaskIdstring

The ID of the instant test task.

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

The name of the instant test task.

task1

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError message
400InvalidQueryParameter%s
400IllegalAddressIllegal HTTP address
400OperationErrorOperation failed
400TaskNotExistsTask does not exist
400OperatorInvalidOperator invalid
400OperatorCityInvalidOperator City invalid
400NameRepeatTask name repeat
400CreateAlarmErrorCreate alarm error
400NameNotExistsTask name not exists
400IllegalAddressProbe address not allowed
401AccessDeniedExceptionYou donot have sufficient access to perform this action.
402LimitExceededThe quota for this customer had been reached.
403%s%s
403Forbidden%s
406ExceedingQuotaExceeding quota limits.
500InternalError%s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-06-22The Error code has changedView Change Details