获取采集器列表信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
elasticsearch:ListCollectors |
get |
*全部资源
|
无 | 无 |
请求语法
GET /openapi/collectors HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| resId |
string |
否 |
采集器 ID。 |
ct-cn-77uqof2s7rg5c**** |
| name |
string |
否 |
采集器名称。 |
collectorName1 |
| instanceId |
string |
否 |
采集器关联的实例 ID。 |
es-cn-nif1q8auz0003**** |
| page |
integer |
否 |
返回结果的分页数。默认值:1,最小值:1,最大值:200。 |
1 |
| size |
integer |
否 |
每页的结果数。默认值:20,最小值:1,最大值:500。 |
10 |
| sourceType |
string |
否 |
指定采集器部署机器的类型,不填返回全部类型。可选值:
|
ECS |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1**** |
| Headers |
object |
返回头信息。 |
|
| X-Total-Count |
integer |
返回的记录数。 |
5 |
| Result |
array<object> |
返回结果。 |
|
|
array<object> |
|||
| configs |
array<object> |
采集器的配置文件信息。 |
|
|
object |
|||
| fileName |
string |
文件名称。 |
fields.yml |
| content |
string |
文件内容。 |
- key: log\n title: Log file content\n description: >\n Contains log file lines.\n .... |
| dryRun |
boolean |
是否校验并创建采集器。支持:
|
false |
| resType |
string |
采集器类型。支持 fileBeat、metricBeat、heartBeat 和 auditBeat。 |
fileBeat |
| ownerId |
string |
账号 ID。 |
168520994880**** |
| resId |
string |
采集器实例 ID。 |
ct-cn-0v3xj86085dvq**** |
| collectorPaths |
array |
Filebeat 采集路径列表。 |
|
|
string |
Filebeat 的采集路径。 |
["/var/log"] |
|
| gmtUpdateTime |
string |
采集器更新时间。 |
2020-08-18T09:40:43.000+0000 |
| extendConfigs |
array<object> |
扩展参数信息。 |
|
|
array<object> |
|||
| enableMonitoring |
boolean |
是否启用 Monitoring,当 configType 为 collectorTargetInstance,且 instanceType 为 elasticsearch 时显示。支持:
|
true |
| hosts |
array |
采集器目标实例的主机地址列表。 |
|
|
string |
采集器 Output 指定实例的访问地址列表。当 configType 为 collectorTargetInstance 时显示。 |
["es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200"] |
|
| instanceType |
string |
采集器 Output 指定的实例类型。支持 elasticsearch、logstash。当 configType 为 collectorTargetInstance 时显示。 |
elasticsearch |
| groupId |
string |
机器组 ID。当 configType 为 collectorDeployMachine 时显示。 |
default_ct-cn-5i2l75bz4776**** |
| userName |
string |
采集器 Output 指定实例的访问用户名,默认为 elastic。当 configType 为 collectorTargetInstance 或 collectorElasticsearchForKibana 时显示。 |
elastic |
| type |
string |
采集器部署的机器类型,当 configType 为 collectorDeployMachine 时显示。支持:
|
ECSInstanceId |
| configType |
string |
配置类型。支持:
|
collectorDeployMachine |
| protocol |
string |
传输协议,需要与采集器 Output 指定实例的访问协议保持一致。支持 HTTP、HTTPS。当 configType 为 collectorTargetInstance 时显示。 |
HTTP |
| instanceId |
string |
采集器关联的实例 ID。当 configType 为 collectorTargetInstance 时,为采集器 Output 的实例 ID;当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时,为 ACK(容器 Kubernetes)集群 ID。 |
es-cn-nif1z89fz003i**** |
| host |
string |
启用 Kibana Dashboard 后,Kibana 的私网访问地址。当 configType 为 collectorElasticsearchForKibana 时显示。 |
es-cn-n6w1o1x0w001c****-kibana.internal.elasticsearch.aliyuncs.com:5601 |
| kibanaHost |
string |
启用 Kibana Dashboard 后,Kibana 的公网访问地址。当 configType 为 collectorElasticsearchForKibana 时显示。 |
https://es-cn-nif1z89fz003i****.kibana.elasticsearch.aliyuncs.com:5601 |
| totalPodsCount |
string |
ACK 集群所有采集的 Pod 节点数。当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时显示。 |
10 |
| successPodsCount |
string |
ACK 集群所有成功采集的 Pod 节点数。当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时显示。 |
8 |
| machines |
array<object> |
采集器所部署的 ECS 机器列表信息。当 configType 为 collectorDeployMachines,且 type 为 ECSInstanceId 时显示。 |
|
|
object |
|||
| instanceId |
string |
ECS 机器 ID 列表。 |
i-bp13y63575oypr9d**** |
| agentStatus |
string |
ECS 上各采集器的状态。支持:
|
heartOk |
| resVersion |
string |
采集器版本。 |
6.8.5_with_community |
| vpcId |
string |
采集器所在的专有网络 ID。 |
vpc-bp16k1dvzxtma***** |
| name |
string |
采集器名称。 |
FileBeat001 |
| gmtCreatedTime |
string |
采集器创建时间。 |
2020-08-18T02:06:12.000+0000 |
| status |
string |
采集器状态。支持:
|
active |
extendConfigs 中包括 3 种 configType,分别为 collectorTargetInstance、collectorElasticsearchForKibana、collectorDeployMachine,部署机器不同,返回的参数不同,具体组合方式如下:
-
collectorTargetInstance
ECS configType、instanceId、instanceType、hosts、userName、password、protocol、enableMonitoring
ACK configType、instanceId、instanceType、userName、password、protocol、enableMonitoring
-
collectorElasticsearchForKibana
ECS configType、instanceId、host、kibanaHost、userName、password、protocol
ACK configType
-
collectorDeployMachine
ECS configType、type、machines、groupId
ACK configType、type、instanceId、totalPodsCount、successPodsCount
示例
正常返回示例
JSON格式
{
"RequestId": "5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1****",
"Headers": {
"X-Total-Count": 5
},
"Result": [
{
"configs": [
{
"fileName": "fields.yml",
"content": "- key: log\\n title: Log file content\\n description: >\\n Contains log file lines.\\n ...."
}
],
"dryRun": false,
"resType": "fileBeat",
"ownerId": "168520994880****",
"resId": "ct-cn-0v3xj86085dvq****",
"collectorPaths": [
"[\"/var/log\"]"
],
"gmtUpdateTime": "2020-08-18T09:40:43.000+0000",
"extendConfigs": [
{
"enableMonitoring": true,
"hosts": [
"[\"es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200\"]"
],
"instanceType": "elasticsearch",
"groupId": "default_ct-cn-5i2l75bz4776****",
"userName": "elastic",
"type": "ECSInstanceId",
"configType": "collectorDeployMachine",
"protocol": "HTTP",
"instanceId": "es-cn-nif1z89fz003i****",
"host": "es-cn-n6w1o1x0w001c****-kibana.internal.elasticsearch.aliyuncs.com:5601",
"kibanaHost": "https://es-cn-nif1z89fz003i****.kibana.elasticsearch.aliyuncs.com:5601",
"totalPodsCount": "10",
"successPodsCount": "8",
"machines": [
{
"instanceId": "i-bp13y63575oypr9d****",
"agentStatus": "heartOk"
}
]
}
],
"resVersion": "6.8.5_with_community",
"vpcId": "vpc-bp16k1dvzxtma*****",
"name": "FileBeat001",
"gmtCreatedTime": "2020-08-18T02:06:12.000+0000",
"status": "active"
}
]
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | ComponentCodeValueError | component value is disable | |
| 401 | UserNotOpen | Aliyun account is not open elasticsearch | |
| 401 | StsRoleAccountNoPermission | Role account has no permission or expired | |
| 401 | SubAccountNoPermission | Aliyun sub account has no permission, please authorize your sub account in Aliyun RAM | |
| 401 | UserUnauthorized | Authentication required |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。