Modifies an availability monitoring task.

In this example, the 12345 availability monitoring task in the 123456 application group is changed to task2.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyHostAvailability

The operation that you want to perform. Set the value to ModifyHostAvailability.

AlertConfig.NotifyType Integer Yes 0

The alert notification method.

Set the value to 0. The value 0 indicates that alert notifications are sent by using emails and DingTalk chatbots.

AlertConfigEscalationList.N.MetricName String Yes HttpStatus

The metric for which the alerting feature is enabled. Valid values of N: 1 to 21. Valid values of the AlertConfigEscalationList.N.MetricName parameter:

  • HttpStatus: HTTP status code
  • HttpLatency: HTTP response time
  • TelnetStatus: TELNET status code
  • TelnetLatency: TELNET response time
  • PingLostRate: PING packet loss rate
GroupId Long Yes 123456

The ID of the application group.

Id Long Yes 12345

The ID of the availability monitoring task.

TaskName String Yes task2

The name of the availability monitoring task.

TaskScope String No GROUP

The monitoring range of the availability monitoring task. Valid values:

  • GROUP: monitors all Elastic Compute Service (ECS) instances in the application group
  • GROUP_SPEC_INSTANCE: monitors specific ECS instances in the application group The TaskScope and InstanceList.N parameters must be used in pairs.
TaskOption.HttpURI String No https://www.aliyun.com

The URI to be monitored. Set this parameter if the TaskType parameter is set to HTTP.

TaskOption.TelnetOrPingHost String No www.aliyun.com

The domain name or IP address to be monitored.

Note Set this parameter if the TaskType parameter is set to PING or TELNET. For more information about how to set the TaskType parameter, see CreateHostAvailability.
TaskOption.HttpResponseCharset String No UTF-8

The character set that is used in the HTTP response.

TaskOption.HttpPostContent String No params1=value1

The post body in the HTTP request.

TaskOption.HttpResponseMatchContent String No ok

The response to the HTTP request.

TaskOption.HttpMethod String No GET

The HTTP request method. Valid values:

  • GET
  • POST
  • HEAD
Note Set this parameter if the TaskType parameter is set to HTTP. For more information about how to set the TaskType parameter, see CreateHostAvailability.
TaskOption.HttpNegative Boolean No true

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 Set this parameter if the TaskType parameter is set to HTTP. For more information about how to set the TaskType parameter, see CreateHostAvailability.
TaskOption.HttpHeader String No params1:value1

The header of the HTTP request. Format: Parameter name: Parameter value. Separate multiple parameters with carriage returns and line feeds. Example:


params1:value1
params2:value2
AlertConfig.StartTime Integer No 0

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

Note If a threshold-triggered alert is generated not during the effective period, notifications are not sent for the alert.
AlertConfig.EndTime Integer No 23

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

Note If a threshold-triggered alert is generated not during the effective period, notifications are not sent for the alert.
AlertConfig.SilenceTime Integer No 86400

The mute period during which notifications are not repeatedly sent for an alert. Unit: seconds. Default value: 86400. The default value indicates one day.

AlertConfig.WebHook String No https://www.aliyun.com/webhook.json

The callback URL.

AlertConfigEscalationList.N.Aggregate String No Value

The method used to calculate metric values that trigger alerts. Valid values of N: 1 to 21. The value of this parameter varies with the metric. The following points describe 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 latency and packet loss rates.
AlertConfigEscalationList.N.Times Integer No 3

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

AlertConfigEscalationList.N.Operator String No >

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

  • >
  • >=
  • <
  • <=
  • =
AlertConfigEscalationList.N.Value String No 3

The threshold of the metric value. Valid values of N: 1 to 21.

InstanceList.N RepeatList No i-absdfkwl321****

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

Note If this parameter is not specified, all instances in the application group are monitored.

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

Response parameters

Parameter Type Example Description
RequestId String 16E815A3-47E1-4290-87F9-D5C99471FF45

The ID of the request.

Message String The specified resource is not found.

The error message.

Code String 200

The HTTP status code.

Note The value 200 indicates that the call was successful.
Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ModifyHostAvailability
&AlertConfig.1otifyType=0
&AlertConfigEscalationList.1.MetricName=HttpStatus
&GroupId=123456
&Id=12345
&TaskName=task2
&<Common request parameters>

Sample success responses

XML format

<ModifyHostAvailabilityResponse>
		  <RequestId>16E815A3-47E1-4290-87F9-D5C99471FF45</RequestId>
		  <Success>true</Success>
		  <Code>200</Code>
</ModifyHostAvailabilityResponse>

JSON format

{
	"RequestId": "16E815A3-47E1-4290-87F9-D5C99471FF45",
	"Code": 200,
	"Success": true
}

Error codes

HttpCode Error code Error message Description
404 ResourceNotFound The specified resource is not found. The error message returned because the specified resource is not found.

For a list of error codes, visit the API Error Center.