All Products
Search
Document Center

CloudMonitor:ModifyHostAvailability

Last Updated:Oct 29, 2024

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.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:ModifyHostAvailabilityupdate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
GroupIdlongYes

The ID of the application group.

123456
IdlongYes

The ID of the availability monitoring task.

12345
TaskNamestringYes

The name of the availability monitoring task.

task2
TaskScopestringNo

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

  • GROUP: All Elastic Compute Service (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.N parameter. The InstanceList.N parameter specifies the ECS instances to be monitored.
GROUP
TaskOption.HttpURIstringNo

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
TaskOption.TelnetOrPingHoststringNo

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.HttpResponseCharsetstringNo

The character set that is used in the HTTP response.

Note Only UTF-8 is supported.
UTF-8
TaskOption.HttpPostContentstringNo

The content of the HTTP POST request.

params1=value1
TaskOption.HttpResponseMatchContentstringNo

The response to the HTTP request.

ok
TaskOption.HttpMethodstringNo

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.HttpNegativebooleanNo

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.HttpHeaderstringNo

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.IntervalintegerNo

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.NotifyTypeintegerYes

The alert notification methods. Valid values:

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

0
AlertConfig.StartTimeintegerNo

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.EndTimeintegerNo

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.SilenceTimeintegerNo

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.WebHookstringNo

The callback URL.

https://www.aliyun.com/webhook.json
AlertConfigEscalationListarray<object>Yes

The alert configurations.

objectYes

The alert configurations.

MetricNamestringYes

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
ValuestringNo

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

3
TimesintegerNo

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
OperatorstringNo

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

  • >
  • >=
  • <
  • <=
  • =
>
AggregatestringNo

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
InstanceListarrayNo

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.
stringNo

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
AlertConfigTargetListarray<object>No

The information about the resources for which alerts are triggered.

objectNo

The information about the resource for which alerts are triggered.

IdstringNo

The ID of the resource for which alerts are triggered.

1
ArnstringNo

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
LevelstringNo

The alert level. Valid values:

  • INFO
  • WARN
  • CRITICAL
["INFO", "WARN", "CRITICAL"]
JsonParamsstringNo

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 parameters

ParameterTypeDescriptionExample
object

None

Codestring

The status code.

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

The error message.

The specified resource is not found.
RequestIdstring

The request ID.

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

Indicates whether the request was successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400ParameterInvalidIllegal parameters.-
403AccessForbiddenUser not authorized to operate on the specified resource.-
404ResourceNotFoundThe specified resource is not found.The specified resource is not found.
409ResourceConflictConcurrent modification of resources.-
409ResourceExistResources already exist.-
500InternalErrorThe request processing has failed due to some unknown error.-

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

Change history

Change timeSummary of changesOperation
2022-08-05The Error code has changed. The request parameters of the API has changedView Change Details