调用DescribeSiteMonitorList接口查询站点监控任务列表。
本文将提供一个示例,查询当前账号的站点监控任务列表。返回结果显示,当前账号存在一条站点监控记录HanZhou_ECS2。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | DescribeSiteMonitorList | 要执行的操作,取值:DescribeSiteMonitorList。 |
| TaskId | String | 否 | a1ecd34a-8157-44d9-b060-14950837**** | 站点监控任务ID。 |
| TaskType | String | 否 | HTTP | 站点监控任务探测类型。云监控支持的探测类型包括:HTTP 、PING 、TCP 、UDP 、DNS 、SMTP 、POP3 、FTP。 |
| Keyword | String | 否 | site | 查询站点监控任务的关键字。 说明 支持根据任务名称或任务地址模糊搜索。 |
| Page | Integer | 否 | 1 | 分页页码。默认值:1。 |
| PageSize | Integer | 否 | 10 | 每页显示条数。默认值:10。 |
| TaskState | String | 否 | 1 | 任务状态。取值:
|
关于公共请求参数的详情,请参见公共参数。
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| RequestId | String | A80DB41C-AF6C-50E1-ADB5-66DCBA3D266B | 请求ID。 |
| Success | String | true | 操作是否成功。取值:
|
| Code | String | 200 | 状态码。 说明 200表示成功。 |
| Message | String | successful | 返回信息。 |
| PageNumber | Integer | 1 | 分页页码。 |
| PageSize | Integer | 10 | 每页显示记录条数。 |
| TotalCount | Integer | 1 | 总记录条数。 |
| SiteMonitors | Array of SiteMonitor | 站点监控任务列表。 |
|
| SiteMonitor | |||
| TaskType | String | TCP | 站点监控任务探测类型。云监控支持的探测类型包括:HTTP 、PING 、TCP 、UDP 、DNS 、SMTP 、POP3 、FTP。 |
| UpdateTime | String | 2022-03-08 17:14:31 | 站点监控任务更新时间。 |
| Interval | String | 1 | 探测频率。单位:分钟。 |
| TaskState | String | 1 | 任务状态。取值:
|
| CreateTime | String | 2021-11-01 11:05:18 | 任务的创建时间。 |
| TaskName | String | 新的探测任务 | 站点监控任务名称。 |
| Address | String | https://aliyun.com | 任务的探测URL地址或IP地址。 |
| TaskId | String | f5783760-1b39-4b6b-80e8-453d962a**** | 站点监控任务ID。 |
| OptionsJson | Object | 扩展选项。每一种探测类型有不同的扩展类型,详情请参见CreateSiteMonitor。 |
|
| password | String | 123**** | SMTP、POP3或FTP探测类型的密码。 |
| request_format | String | hex | HTTP请求内容格式。取值:
|
| response_content | String | cf0f85 | 匹配响应内容。
|
| failure_rate | Float | 0.5 | 丢包率。 说明 该参数仅适用于PING探测类型。 |
| time_out | Long | 3000 | 超时时间。单位:毫秒。 |
| header | String | testKey:testValue | HTTP请求头。格式为 |
| cookie | String | lang=en | 发送HTTP请求的Cookie文本。 |
| port | Integer | 80 | TCP、UDP、SMTP或POP3探测类型的端口。 |
| ping_num | Integer | 20 | PING探测的次数设置。 |
| authentication | Integer | 1 | 是否开启安全验证。取值:
|
| http_method | String | get | HTTP的请求方法。取值:
|
| match_rule | Integer | 0 | 是否包含报警规则。取值:
|
| dns_match_rule | String | IN_DNS | DNS的匹配规则。取值:
|
| request_content | String | cf0f85 | HTTP探测请求内容。 |
| username | String | testUser | FTP、SMTP或POP3的用户名。 |
| response_format | String | hex | HTTP响应内容格式。取值:
|
| dns_type | String | A | DNS解析类型。仅适用于DNS探测类型。取值:
|
| dns_server | String | 192.168.XX.XX | 指定DNS解析服务器的域名或IP地址。 |
| enable_operator_dns | Boolean | true | 是否使用运营商的DNS。
|
| attempts | Long | 3 | DNS失败后重试次数。 |
| protocol | String | udp | DNS探测协议类型。取值:
|
| proxy_protocol | Boolean | false | 是否开启ProxyProtocol。取值:
|
| acceptable_response_code | String | 400 | 可接受的状态码。 说明 建议您使用断言配置。 |
| isBase64Encode | String | false | 是否对密码进行base64解码存储。取值:
|
| cert_verify | Boolean | false | 是否验证证书。取值:
|
| unfollow_redirect | Boolean | false | 如果出现301或302状态码,是否跟随再次做重定向探测。取值:
|
| diagnosis_mtr | Boolean | false | 是否开启任务失败后的自动MTR网络诊断。取值:
|
| diagnosis_ping | Boolean | false | 是否开启探测任务失败后自动Ping网络延时探测。取值:
|
| retry_delay | Integer | 1 | 探测失败后重试次数。 |
| assertions | Array of assertions | 断言配置组。 |
|
| assertions | |||
| property | String | json path | 断言内容解析路径。
|
| type | String | response_time | 断言类型。取值:
|
| operator | String | lessThan | 断言比较操作符。取值:
|
| target | String | 1000 | 断言匹配比较的目标数值或字符。 |
| AgentGroup | String | PC | 探针类型。取值:
|
示例
请求示例
http(s)://[Endpoint]/?Action=DescribeSiteMonitorList
&<公共请求参数>
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeSiteMonitorListResponse>
<TotalCount>1</TotalCount>
<RequestId>A80DB41C-AF6C-50E1-ADB5-66DCBA3D266B</RequestId>
<Message>successful</Message>
<PageSize>10</PageSize>
<PageNumber>1</PageNumber>
<Code>200</Code>
<Success>true</Success>
<SiteMonitors>
<SiteMonitor>
<TaskId>f5783760-1b39-4b6b-80e8-453d962a****</TaskId>
<Address>https://aliyun.com</Address>
<EndTime></EndTime>
<TaskName>test123</TaskName>
<OptionsJson>
<response_content></response_content>
<request_format>hex</request_format>
<response_format>hex</response_format>
<request_content>cf0f85</request_content>
<port>80</port>
</OptionsJson>
<TaskType>TCP</TaskType>
<CreateTime>2021-11-01 11:05:18</CreateTime>
<UpdateTime>2022-03-08 17:14:31</UpdateTime>
<TaskState>1</TaskState>
<Interval>1</Interval>
</SiteMonitor>
</SiteMonitors>
</DescribeSiteMonitorListResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"TotalCount" : 1,
"RequestId" : "A80DB41C-AF6C-50E1-ADB5-66DCBA3D266B",
"Message" : "successful",
"PageSize" : 10,
"PageNumber" : 1,
"Code" : "200",
"Success" : true,
"SiteMonitors" : {
"SiteMonitor" : [ {
"TaskId" : "f5783760-1b39-4b6b-80e8-453d962a****",
"Address" : "https://aliyun.com",
"EndTime" : "",
"TaskName" : "test123",
"OptionsJson" : {
"response_content" : "",
"request_format" : "hex",
"response_format" : "hex",
"request_content" : "cf0f85",
"port" : 80
},
"TaskType" : "TCP",
"CreateTime" : "2021-11-01 11:05:18",
"UpdateTime" : "2022-03-08 17:14:31",
"TaskState" : 1,
"Interval" : 1
} ]
}
}
错误码
访问错误中心查看更多错误码。