All Products
Search
Document Center

Cloud Monitor:CreateHostAvailability

Last Updated:Jul 10, 2026

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

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:CreateHostAvailability

create

*HostAvailability

acs:cms::{#accountId}:group/{#groupId}

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: uses all ECS instances in the current application group as detection probes.

  • GROUP_SPEC_INSTANCE: uses specified ECS instances in the current application group as detection probes. If you set this parameter to GROUP_SPEC_INSTANCE, you must also set InstanceList to specify the ECS instances that initiate detection.

GROUP

TaskType

string

Yes

The detection type of the availability monitoring task. Valid values:

  • PING

  • TELNET

  • HTTP

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:

  • GET

  • POST

  • HEAD

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:

  • true: An alert is triggered if the HTTP response content contains the specified alert rule content.

  • false: An alert is triggered if the HTTP response content does not contain the specified alert rule content.

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 Parameter name:Parameter value. Separate multiple parameters with line breaks. Example:

params1:value1
params2:value2

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 AlertConfig.StartTime is set to 0 and AlertConfig.EndTime is set to 22, the alert is effective from 00:00:00 to 22:00:00.

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 AlertConfig.StartTime is set to 0 and AlertConfig.EndTime is set to 22, the alert is effective from 00:00:00 to 22:00:00.

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: HTTP status code.

  • HttpLatency: HTTP latency.

  • TelnetStatus: Telnet status code.

  • TelnetLatency: Telnet latency.

  • PingLostRate: Ping packet loss rate.

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:

  • HttpStatus: Value.

  • HttpLatency: Average.

  • TelnetStatus: Value.

  • TelnetLatency: Average.

  • PingLostRate: Average.

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 TaskScope is set to GROUP_SPEC_INSTANCE.

i-absdfkwl321****

string

No

The list of ECS instances that initiate detection. Valid values of N: 1 to 21.

Note

Set this parameter when TaskScope is set to GROUP_SPEC_INSTANCE.

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:{AbbreviatedCloudServiceName}:{regionId}:{userId}:/{ResourceType}/{ResourceName}/message. Example: acs:mns:ap-southeast-1:120886317861****:/queues/test123/message. The following list describes the parameters:

  • {AbbreviatedCloudServiceName}: Only Simple Message Queue (formerly MNS) is supported.

  • {userId}: The Alibaba Cloud account ID.

  • {regionId}: The region where the Simple Message Queue (formerly MNS) queue or topic resides.

  • {ResourceType}: The type of the resource that accepts alerts. Valid values:

    • queues: queue.

    • topics: topic.

  • {ResourceName}: The resource name.

    • If the resource type is queues, the resource name is the queue name.

    • If the resource type is topics, the resource name is the topic name.

acs:mns:cn-hangzhou:120886317861****:/queues/test/message

Level

string

No

The alert level. Valid values:

  • INFO: information.

  • WARN: warning.

  • CRITICAL: critical.

["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: The operation was successful.

  • false: The operation failed.

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.