All Products
Search
Document Center

Cloud Monitor:ModifyHostAvailability

Last Updated:Jan 23, 2026

Modifies an availability monitoring task.

Operation description

This topic provides an example on how to change the name of an availability monitoring task named 12345 in an application group named 123456 to task2.

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

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

GroupId

integer

Yes

The ID of the application group.

123456

Id

integer

Yes

The ID of the availability monitoring task.

12345

TaskName

string

Yes

The name of the availability monitoring task.

task2

TaskScope

string

No

The range of instances that are monitored by the availability monitoring task. Valid values:

  • GROUP: All ECS instances in the application group are monitored.

  • GROUP_SPEC_INSTANCE: Specified ECS instances in the application group are monitored. The TaskScope parameter must be used in combination with the InstanceList parameter. The InstanceList parameter specifies the ECS instances to be monitored.

GROUP

TaskOption.HttpURI

string

No

The URI that you want to monitor. This parameter is required if the TaskType parameter is set to HTTP or Telnet.

https://www.aliyun.com telnet://127.0.0.1:80

TaskOption.TelnetOrPingHost

string

No

The domain name or IP address that you want to monitor.

Note

This parameter is required if the TaskType parameter is set to PING. For more information about how to set the TaskType parameter, see CreateHostAvailability.

www.aliyun.com

TaskOption.HttpResponseCharset

string

No

The character set that is used in the HTTP response.

Note

Only UTF-8 is supported.

UTF-8

TaskOption.HttpPostContent

string

No

The content of the HTTP POST request.

params1=value1

TaskOption.HttpResponseMatchContent

string

No

The response to the HTTP request.

ok

TaskOption.HttpMethod

string

No

The HTTP request method. Valid values:

  • GET

  • POST

  • HEAD

Note

This parameter must be specified when TaskType is set to HTTP. For more information about how to configure the TaskType parameter, see CreateHostAvailability.

GET

TaskOption.HttpNegative

boolean

No

The method to trigger an alert. The alert can be triggered based on whether the specified alert rule is included in the response body. Valid values:

  • true: If the HTTP response body includes the alert rule, an alert is triggered.

  • false: If the HTTP response does not include the alert rule, an alert is triggered.

Note

This parameter must be specified when TaskType is set to HTTP. For more information about how to configure the TaskType parameter, see CreateHostAvailability.

true

TaskOption.HttpHeader

string

No

The header of the HTTP request. Format: Parameter name:Parameter value. Separate multiple parameters with carriage return characters. Example:

params1:value1
params2:value2

params1:value1

TaskOption.Interval

integer

No

The interval at which detection requests are sent. Unit: seconds. Valid values: 15, 30, 60, 120, 300, 900, 1800, and 3600.

Note

This parameter is available only for the CloudMonitor agent V3.5.1 or later.

60

AlertConfig.NotifyType

integer

Yes

The alert notification methods. Valid values:

0: Alert notifications are sent by using emails and DingTalk chatbots.

0

AlertConfig.StartTime

integer

No

The beginning of the time range during which the alert rule is effective. Valid values: 0 to 23.

For example, if the AlertConfig.StartTime parameter is set to 0 and the AlertConfig.EndTime parameter is set to 22, the alert rule is effective from 00:00:00 to 22:00:00.

Note

Alert notifications are sent based on the specified threshold only if the alert rule is effective.

0

AlertConfig.EndTime

integer

No

The end of the time range during which the alert rule is effective. Valid values: 0 to 23.

For example, if the AlertConfig.StartTime parameter is set to 0 and the AlertConfig.EndTime parameter is set to 22, the alert rule is effective from 00:00:00 to 22:00:00.

Note

Alert notifications are sent based on the specified threshold only if the alert rule is effective.

22

AlertConfig.SilenceTime

integer

No

The mute period during which new alerts are not sent even if the trigger conditions are met. Unit: seconds. Default value: 86400. The default value indicates one day.

86400

AlertConfig.WebHook

string

No

The callback URL.

https://www.aliyun.com/webhook.json

AlertConfigEscalationList

array<object>

Yes

The alert configurations.

object

No

The alert configurations.

MetricName

string

Yes

The metric for which the alert feature is enabled. Valid values of N: 1 to 21. Valid values:

  • HttpStatus: HTTP status code

  • HttpLatency: HTTP response time

  • TelnetStatus: Telnet status code

  • TelnetLatency: Telnet response time

  • PingLostRate: Ping packet loss rate

HttpStatus

Value

string

No

The alert threshold. Valid values of N: 1 to 21.

3

Times

integer

No

The consecutive number of times for which the metric value meets the alert condition before an alert is triggered. Valid values of N: 1 to 21.

3

Operator

string

No

The comparison operator that is used in the alert rule. Valid values of N: 1 to 21. Valid values:

  • >

  • >=

  • <

  • <=

  • =

>

Aggregate

string

No

The method used to calculate the metric values that trigger alerts. Valid values of N: 1 to 21. The value of this parameter varies based on the metric. The following items show the correspondence between metrics and calculation methods:

  • HttpStatus: Value

  • HttpLatency: Average

  • TelnetStatus: Value

  • TelnetLatency: Average

  • PingLostRate: Average

Note

The value Value indicates the original value and is used for metrics such as status codes. The value Average indicates the average value and is used for metrics such as the latency and packet loss rate.

Value

InstanceList

array

No

The ECS instances that are monitored. Valid values of N: 1 to 21.

Note

This parameter must be specified when TaskScope is set to GROUP_SPEC_INSTANCE.

i-absdfkwl321****

string

No

The ECS instances that are monitored. Valid values of N: 1 to 21.

Note

This parameter must be specified when TaskScope is set to GROUP_SPEC_INSTANCE.

2

AlertConfigTargetList

array<object>

No

The information about the resources for which alerts are triggered.

object

No

The information about the resource for which alerts are triggered.

Id

string

No

The ID of the resource for which alerts are triggered.

1

Arn

string

No

The Alibaba Cloud Resource Name (ARN) of the resource.

Format: acs:{Service name abbreviation}:{regionId}:{userId}:/{Resource type}/{Resource name}/message. Example: acs:mns:cn-hangzhou:120886317861****:/queues/test123/message. Fields:

  • {Service name abbreviation}: the abbreviation of the service name. Set the value to Simple Message Queue (formerly MNS) (SMQ).

  • {userId}: the ID of the Alibaba Cloud account.

  • {regionId}: the region ID of the SMQ queue or topic.

  • {Resource type}: the type of the resource for which alerts are triggered. Valid values:

    • queues

    • topics

  • {Resource name}: 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:111:/queues/test/message

Level

string

No

The alert level. Valid values:

  • INFO

  • WARN

  • CRITICAL

["INFO", "WARN", "CRITICAL"]

JsonParams

string

No

The parameters of the alert callback. The parameters are in the JSON format.

{"customField1":"value1","customField2":"$.name"}

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

None

Code

string

The status code.

Note

The status code 200 indicates that the request was successful.

200

Message

string

The error message.

The specified resource is not found.

RequestId

string

The request ID.

16E815A3-47E1-4290-87F9-D5C99471FF45

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "The specified resource is not found.",
  "RequestId": "16E815A3-47E1-4290-87F9-D5C99471FF45",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 ParameterInvalid Illegal parameters.
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 The specified resource is not found. The specified resource is not found.
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.