ModifySiteMonitor - 修改站点监控任务

更新时间:
复制为 MD 格式

调用ModifySiteMonitor接口修改站点监控任务。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

cms:ModifySiteMonitor

update

*全部资源

*

请求参数

名称

类型

必填

描述

示例值

Address

string

监控任务的 URL 或 IP 地址。

http://www.aliyun.com

TaskId

string

监控任务 ID。

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

TaskName

string

监控任务名称。长度 4~100 个字符,取值可包含英文字母、数字、下划线(_)和汉字。

HanZhou_ECS2

Interval

string

监控频率。取值:1、5、15。单位:分钟。默认值:1。

1

IspCities

string

探针信息。格式为 JSONArray,例如:[{"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}]city分别对应北京、杭州和青岛。

说明

您可以通过 DescribeSiteMonitorISPCityList 接口获取探测点信息,请参见 DescribeSiteMonitorISPCityList 。如果该参数取值为空,则系统随机选择 3 个探测点。

[{"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}]

OptionsJson

string

监控任务对应协议类型的高级扩展选项。不同监控任务的协议类型对应不同的扩展选项。

{"time_out":5000}

AlertIds

string

报警规则 ID。云监控中已存在的报警规则 ID,可通过 DescribeMetricRuleList 接口查询,请参见 DescribeMetricRuleList

49f7c317-7645-4cc9-94fd-ea42e122****

IntervalUnit

string

监控指标的单位。

单位:毫秒(ms)。

ms

CustomSchedule

string

自定义探测周期。只能选择周一至周日的某个时间段进行探测。

{"start_hour":0,"end_hour":24, "days":[0], "time_zone":"Local"}

站点监控支持以下 8 种任务类型,每种任务类型对应的扩展参数(OptionsJson)如下表所示。

  • HTTP

名称类型描述
http_methodStringHTTP 请求方式,支持三种:GET、POST、HEAD。默认值:GET。
headerString换行符(\n)分隔的自定义 HTTP header。
每行 header 格式需符合 HTTP 协议(使用英文冒号分隔的键值)。
cookieStringcookie 和 HTTP 请求标准的写法一致。
request_contentString请求内容。支持两种格式:JSON 和表单。不提供时,请求中不含正文。
response_contentString期望的响应内容。探测时会在 HTTP 服务器返回的前 64 个字节进行检查。
match_ruleString0:响应中不含 response_content 时,探测成功。
1:响应中含 response_content 时,探测成功。
usernameString如果提供 username,则会在 HTTP 请求中携带 BasicAuth header。
passwordStringHTTP 请求验证密码。
time_outint超时时间。单位:毫秒。默认值:5 。
max_redirectint大跳转次数。ECS 探针默认 5 次,运营商探针默认 2 次。
如果需要禁止跳转,则将该参数设置为:0。
取值范围:0~50 。
  • PING

名称类型描述
failure_rateint当 PING 失败率超过该参数时,探测失败,返回 610(PingAllFail)或 615(PingPartialFail)。
默认值:0.1。
ping_numintPING 次数,默认值:20。
取值范围:1~100。
  • DNS

名称类型描述
dns_serverstringDNS 服务器地址,可以为域名或 IP 地址。
dns_typestringDNS 查询类型。取值:A、NS、CNAME、MX、TXT、ANY。
expect_valuestring英文空白符分隔的期望值列表。
match_rulestring期望值列表与 DNS 列表的关系,当不满足指定关系时,探测失败。
空字符串或 IN_DNS:期望值列表是 DNS 列表的子集。
DNS_IN:DNS 列表是期望值列表的子集。
EQUAL:DNS 列表与期望值列表相等。
ANY:DNS 列表与期望值列表有交集(交集不为空)。
  • FTP

名称类型描述
portintFTP 服务器端口号。如果不提供,则使用默认值。FTP 默认值:21,FTPs 默认值:990。
usernamestringFTP 用户名。 如果未提供,则匿名登录。
passwordstringFTP 密码。
  • POP3/SMTP

名称类型描述
portintPOP3 服务器端口号。POP3 默认值:110,POP3s 默认值:995。
usernamestringPOP3/SMTP 的用户名。
passwordstringPOP3/SMTP 的密码 。
  • TCP/UDP

名称类型描述
portintTCP/UDP 服务器的端口。
request_contentstring请求内容。当 request_format 为 hex 时,request_content 内容为十六进制紧凑格式。
request_formatstring当 request_format 为其他值时,request_content 作为普通字符串发送给 TCP/UDP 服务器。
response_contentstring响应内容。当 TCP/UDP 服务器返回的内容中不含 response_content 时,探测失败。
当 response_format 为 hex 时,response_content 中的内容为十六进制紧凑格式。
当 response_content 为其他值时,response_content 为普通字符串。

返回参数

名称

类型

描述

示例值

object

Code

string

状态码。

说明

200 表示成功。

200

Message

string

返回信息。

successful

RequestId

string

请求 ID。

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

Success

string

操作是否成功。取值:

  • true:成功。

  • false:失败。

true

Data

object

修改任务结果详情。

count

integer

监控任务数。

1

示例

正常返回示例

JSON格式

{
  "Code": "200",
  "Message": "successful",
  "RequestId": "68192f5d-0d45-4b98-9724-892813f86c71",
  "Success": "true",
  "Data": {
    "count": 1
  }
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidQueryParameter %s
400 IllegalAddress Illegal HTTP address
400 OperationError Operation failed
400 TaskNotExists Task does not exist
400 OperatorInvalid %s
400 NameRepeat Task name repeat
400 CreateAlarmError Create alarm error
400 NameNotExists Task name not exists
400 OperatorCityInvalid Invalid Isp. 运营商无效
401 AccessDeniedException You donot have sufficient access to perform this action.
500 InternalError %s
500 InternetServerError System internal error. 系统内部错误
402 LimitExceeded The quota for this customer had been reached.
403 Forbidden You are not authorized to operate the specified resource. 没有权限,请使用RAM进行授权
403 RestrictedUser The user's operation is restricted, please register NAAM product code.
403 UnauthorizedTasks You are not permitted to operate the specified tasks. 您无权操作对应的任务
404 TaskNotExist The specified task does not exist. 任务不存在
406 ExceedingQuota Exceeding quota limits. 任务数量超出限额
429 ThrottlingException The request was denied due to request throttling.
409 %s %s

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情