修改采集器配置。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
elasticsearch:UpdateCollector |
update |
*collectors
|
无 | 无 |
请求语法
PUT /openapi/collectors/{ResId} HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ResId |
string |
是 |
采集器实例 ID。 |
ct-cn-77uqof2s7rg5c**** |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ClientToken |
string |
否 |
用于保证请求的幂等性。由客户端生成该参数值,要保证在不同请求间唯一,最大不超过 64 个 ASCII 字符。 |
5A2CFF0E-5718-45B5-9D4D-70B3FF**** |
| body |
string |
否 |
待更新的采集器配置,采用 JSON 字符串表示。 |
{"name":"collector-demo","resType":"fileBeat","resVersion":"6.8.5_with_community","vpcId":"vpc-bp1example123456789","collectorPaths":["/var/log/app.log"],"extendConfigs":[{"configType":"collectorDeployMachine","type":"ECSInstanceId","machines":[{"instanceId":"i-bp1example123456789"}]},{"configType":"collectorTargetInstance","instanceType":"elasticsearch","instanceId":"es-cn-example12345678","protocol":"HTTP","hosts":["es-cn-example12345678.elasticsearch.aliyuncs.com:9200"],"userName":"elastic","password":"ExamplePwd123!","enableMonitoring":false}]} |
RequestBody
RequestBody 中还需填入以下参数,用来指定待更新采集器的配置信息。
| 参数 | 类型 | 是否必选 | 示例值 | 描述 |
| dryRun | boolean | 是 | false | 是否校验并更新采集器。可选值:true(只校验不更新)、false(校验并更新)。 |
| name | String | 是 | ct-test | 采集器名称。 |
| status | String | 是 | activing | 采集器状态。可选值:activing(生效中)、active(已生效)。 |
| resType | String | 是 | fileBeat | 采集器类型。可选值:fileBeat、metricBeat、heartBeat、auditBeat。 |
| vpcId | String | 是 | vpc-bp16k1dvzxtma***** | 采集器所在的专有网络 ID。 |
| resVersion | String | 是 | 6.8.5_with_community | 采集器版本。 |
| ownerId | String | 是 | 16852099488***** | 账号 ID。 |
| gmtCreatedTime | Date | 是 | 2020-06-20T07:26:47.000+0000 | 采集器创建时间。 |
| gmtUpdateTime | Date | 是 | 2020-06-20T07:26:47.000+0000 | 采集器更新时间。 |
| collectorPaths | List | 否 | ["/var/log"] | Filebeat 采集路径。 |
| configs | List | 是 | 采集器的配置文件信息。 | |
| └fileName | String | 是 | filebeat.yml | 文件名称。 |
| └content | String | 是 | "filebeat.inputs:xxx" | 文件内容。 |
| extendConfigs | Array | 是 | 采集器扩展配置。 | |
| └configType | String | 是 | collectorElasticsearchForKibana | 配置类型。可选值:collectorTargetInstance(采集器 Output)、collectorDeployMachine(采集器的部署机器)、collectorElasticsearchForKibana(支持 Kibana 仪表盘的 Elasticsearch 实例信息)。 |
| └type | String | 是 | ECSInstanceId | 采集器部署的机器类型。可选值:ECSInstanceId(ECS)、ACKCluster(容器 Kubernetes)。当 configType 为 collectorDeployMachine 时必填。 |
| └machines | Array | 否 | 采集器所部署的 ECS 机器列表信息。当 configType 为 collectorDeployMachines,且 type 为 ECSInstanceId 时,必填。 | |
| └└instanceId | String | 否 | i-bp13y63575oypr9d**** | ECS 机器 ID 列表。 |
| └└agentStatus | String | 否 | failed | ECS 上各采集器的状态。可选值:heartOk(心跳正常)、heartLost(心跳异常)、uninstalled(未安装)、failed(安装失败)。 |
| └groupId | String | default_ct-cn-5i2l75bz4776**** | 机器组 ID。当 configType 为 collectorDeployMachine 时,必填。 | |
| └instanceId | String | 是 | es-cn-nif1z89fz003i**** | 采集器关联的实例 ID。当 configType 为 collectorTargetInstance 时,为采集器 Output 的实例 ID;当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时,为 ACK 集群 ID。 |
| └protocol | String | 是 | HTTP | 传输协议,需要与采集器 Output 指定实例的访问协议保持一致。可选值 HTTP、HTTPS。当 configType 为 collectorTargetInstance 时必填。 |
| └userName | String | 是 | elastic | 采集器 Output 指定实例的访问用户名,默认为 elastic。当 configType 为 collectorTargetInstance 或 collectorElasticsearchForKibana 时必填。 |
| └enableMonitoring | Boolean | 是 | true | 是否启用 Monitoring,当 configType 为 collectorTargetInstance,且 instanceType 为 elasticsearch 时必填。可选值:true(启用)、false(不启用)。 |
| └hosts | List | 否 | ["es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200"] | 采集器 Output 指定实例的访问地址列表。当 configType 为 collectorTargetInstance 时必填。 |
| └instanceType | String | 是 | elasticsearch | 采集器 Output 指定的实例类型。可选值:elasticsearch、logstash。当 configType 为 collectorTargetInstance 时必填。 |
| └host | String | 否 | es-cn-n6w1o1x0w001c****-kibana.internal.elasticsearch.aliyuncs.com:5601 | 启用 Kibana Dashboard 后,Kibana 的私网访问地址。当 configType 为 collectorElasticsearchForKibana 时必填。 |
| └kibanaHost | String | 否 | https://es-cn-nif1z89fz003i****.kibana.elasticsearch.aliyuncs.com:5601 | 启用 Kibana Dashboard 后,Kibana 的公网访问地址。当 configType 为 collectorElasticsearchForKibana 时必填。 |
└表示子参数。
特殊参数说明
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
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1D*** |
| Result |
object |
返回结果。 |
|
| resId |
string |
采集器实例 ID。 |
ct-cn-0v3xj86085dvq**** |
| gmtUpdateTime |
string |
采集器更新时间。 |
2020-06-20T07:26:47.000+0000 |
| dryRun |
boolean |
是否校验并创建采集器。支持:
|
false |
| ownerId |
string |
账号 ID。 |
16852099488***** |
| vpcId |
string |
采集器所在的专有网络 ID。 |
vpc-bp16k1dvzxtma***** |
| resType |
string |
采集器类型。支持 fileBeat、metricBeat、heartBeat 和 auditBeat。 |
fileBeat |
| resVersion |
string |
采集器版本。 |
6.8.5_with_community |
| gmtCreatedTime |
string |
采集器创建时间。 |
2020-06-20T07:26:47.000+0000 |
| status |
string |
采集器状态。支持:
|
active |
| name |
string |
采集器名称。 |
ct-test |
| configs |
array<object> |
采集器的配置文件信息。 |
|
|
object |
|||
| content |
string |
文件内容 |
filebeat.inputs:xxx |
| fileName |
string |
文件名称 |
filebeat.yml |
| extendConfigs |
array<object> |
扩展参数信息。 |
|
|
array<object> |
|||
| successPodsCount |
string |
ACK 集群所有成功采集的 Pod 节点数。当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时显示。 |
8 |
| protocol |
string |
传输协议,需要与采集器 Output 指定实例的访问协议保持一致。支持 HTTP、HTTPS。当 configType 为 collectorTargetInstance 时显示。 |
HTTP |
| userName |
string |
采集器 Output 指定实例的访问用户名,默认为 elastic。当 configType 为 collectorTargetInstance 或 collectorElasticsearchForKibana 时显示。 |
elastic |
| totalPodsCount |
string |
ACK 集群所有采集的 Pod 节点数。当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时显示。 |
10 |
| type |
string |
采集器部署的机器类型,当 configType 为 collectorDeployMachine 时显示。支持:
|
ECSInstanceId |
| kibanaHost |
string |
启用 Kibana Dashboard 后,Kibana 的公网访问地址。当 configType 为 collectorElasticsearchForKibana 时显示。 |
https://es-cn-nif1z89fz003i****.kibana.elasticsearch.aliyuncs.com:5601 |
| enableMonitoring |
boolean |
是否启用 Monitoring,当 configType 为 collectorTargetInstance,且 instanceType 为 elasticsearch 时显示。支持 true(启用)、false(不启用)。 |
true |
| configType |
string |
配置类型。支持:
|
collectorDeployMachine |
| instanceType |
string |
采集器 Output 指定的实例类型。支持 elasticsearch、logstash。当 configType 为 collectorTargetInstance 时显示。 |
elasticsearch |
| groupId |
string |
机器组 ID。当 configType 为 collectorDeployMachine 时显示。 |
default_ct-cn-5i2l75bz4776**** |
| host |
string |
启用 Kibana Dashboard 后,Kibana 的私网访问地址。当 configType 为 collectorElasticsearchForKibana 时显示。 |
es-cn-n6w1o1x0w001c****-kibana.internal.elasticsearch.aliyuncs.com:5601 |
| instanceId |
string |
采集器关联的实例 ID。当 configType 为 collectorTargetInstance 时,为采集器 Output 的实例 ID;当 configType 为 collectorDeployMachines,且 type 为 ACKCluster 时,为 ACK(容器 Kubernetes)集群 ID。 |
es-cn-nif1z89fz003i**** |
| machines |
array<object> |
collectorDeployMachine 类型专用: 部署 ECS 机器/ACK 集群信息 |
|
|
object |
|||
| agentStatus |
string |
ECS 上各采集器的状态。支持:
|
heartOk |
| instanceId |
string |
ECS 机器 ID 列表。 |
i-bp13y63575oypr9d**** |
| hosts |
array |
采集器目标实例的主机地址列表。 |
|
|
string |
采集器 Output 指定实例的访问地址列表。当 configType 为 collectorTargetInstance 时显示。 |
["es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200"] |
|
| collectorPaths |
array |
Filebeat 采集路径列表。 |
|
|
string |
Filebeat 的采集路径。 |
["/var/log"] |
示例
正常返回示例
JSON格式
{
"RequestId": "5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1D***",
"Result": {
"resId": "ct-cn-0v3xj86085dvq****",
"gmtUpdateTime": "2020-06-20T07:26:47.000+0000",
"dryRun": false,
"ownerId": "16852099488*****",
"vpcId": "vpc-bp16k1dvzxtma*****",
"resType": "fileBeat",
"resVersion": "6.8.5_with_community",
"gmtCreatedTime": "2020-06-20T07:26:47.000+0000",
"status": "active",
"name": "ct-test",
"configs": [
{
"content": "filebeat.inputs:xxx",
"fileName": "filebeat.yml"
}
],
"extendConfigs": [
{
"successPodsCount": "8",
"protocol": "HTTP",
"userName": "elastic",
"totalPodsCount": "10",
"type": "ECSInstanceId",
"kibanaHost": "https://es-cn-nif1z89fz003i****.kibana.elasticsearch.aliyuncs.com:5601",
"enableMonitoring": true,
"configType": "collectorDeployMachine",
"instanceType": "elasticsearch",
"groupId": "default_ct-cn-5i2l75bz4776****",
"host": "es-cn-n6w1o1x0w001c****-kibana.internal.elasticsearch.aliyuncs.com:5601",
"instanceId": "es-cn-nif1z89fz003i****",
"machines": [
{
"agentStatus": "heartOk",
"instanceId": "i-bp13y63575oypr9d****"
}
],
"hosts": [
"[\"es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200\"]"
]
}
],
"collectorPaths": [
"[\"/var/log\"]"
]
}
}
错误码
|
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 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。