CreateCollector
Creates a collector to collect data from a specified service.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
elasticsearch:CreateCollector |
create |
*All Resource
|
None | None |
Request syntax
POST /openapi/collectors HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| clientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. The value is generated by the client and must be unique among different requests. The token can contain a maximum of 64 ASCII characters. |
5A2CFF0E-5718-45B5-9D4D-70B3FF**** |
| body |
object |
No |
The request body parameters that specify the configuration information for the collector to be created. |
{ "dryRun": false, "name": "test_beats_1", "resType": "fileBeat", "resVersion": "6.8.5_with_community", "vpcId": "vpc-bp12nu14urf0upaf*****", "collectorPaths": [ "/var/log" ], "configs": [ { "fileName": "filebeat.yml", "content": "filebeat.inputs:xxx" } ] } |
| dryRun |
boolean |
Yes |
Specifies whether to perform a dry run. This parameter is used only when you create or update a collector. Valid values:
|
true |
| name |
string |
Yes |
The name of the collector. The name must be 1 to 30 characters in length, and must start with a letter. It can contain letters, digits, underscores (_), and hyphens (-). |
ct-test |
| resType |
string |
Yes |
The type of the collector. Valid values: fileBeat, metricBeat, heartBeat, and auditBeat. Valid values:
|
fileBeat |
| vpcId |
string |
Yes |
The ID of the virtual private cloud (VPC) where the collector resides. |
vpc-bp12nu14urf0upaf***** |
| resVersion |
string |
Yes |
The version of the collector. Valid values:
Valid values:
|
6.8.5_with_community |
| collectorPaths |
array |
No |
The collection paths for Filebeat. This parameter is required only when the collector is installed on ECS instances. |
|
|
string |
No |
The collection paths for Filebeat. This parameter is required only when the collector is installed on ECS instances. |
["/var/log"] |
|
| configs |
array<object> |
Yes |
The configuration file information of the collector. |
|
|
object |
Yes |
The configuration file information of the collector. |
||
| fileName |
string |
Yes |
The name of the file. |
filebeat.yml |
| content |
string |
Yes |
The content of the file. For more information, see https://help.aliyun.com/document_detail/146447.html. |
"filebeat.inputs:xxx" |
| extendConfigs |
array<object> |
Yes |
The extended configuration of the collector. |
|
|
object |
Yes |
The extended configuration of the collector. For more information, see the extendConfigs parameter description section below. |
{"instanceId":"es-cn-nif201ihd0012****","instanceType":"elasticsearch","configType":"collectorTargetInstance","hosts":["es-cn-nif201ihd0012****.elasticsearch.aliyuncs.com:9200"],"userName":"elastic","password":"*****","protocol":"HTTP"} |
extendConfigs parameter description
The parameters in extendConfigs are described as follows.
| Name | Type | Required | Example | Description |
| extendConfigs | Array | The extended configuration of the collector. | ||
| └configType | String | Yes | collectorElasticsearchForKibana | The configuration type. Valid values: collectorTargetInstance (the output instance of the collector), collectorDeployMachine (the machine on which the collector is deployed), and collectorElasticsearchForKibana (the information about the Elasticsearch instance that supports Kibana dashboards). |
| └type | String | No | ECSInstanceId | The type of the machine on which the collector is deployed. Valid values: ECSInstanceId (ECS) and ACKCluster (ACK cluster). This parameter is required when configType is set to collectorDeployMachine. |
| └instanceType | String | No | elasticsearch | The type of the output instance specified for the collector. Valid values: elasticsearch and logstash. This parameter is required when configType is set to collectorTargetInstance. |
| └instanceId | String | Yes | es-cn-nif201ihd0012**** | Instance ID of the instance associated with the collector. When configType is set to collectorTargetInstance, this parameter specifies instance ID of the output instance of the collector. When configType is set to collectorDeployMachines and type is set to ACKCluster, this parameter specifies instance ID of the ACK cluster. |
| └machines | Array | No | The information about the ECS instances on which the collector is deployed. This parameter is required when configType is set to collectorDeployMachines and type is set to ECSInstanceId. | |
| └└instanceId | String | Yes | i-bp11u91xgubypcuz**** | Instance IDs of the ECS instances. |
| └groupId | String | default_ct-cn-5i2l75bz4776**** | Instance ID of the machine group. This parameter is required when configType is set to collectorDeployMachine. | |
| └protocol | String | No | HTTP | The transmission protocol, which must be consistent with the access protocol of the output instance specified for the collector. Valid values: HTTP and HTTPS. This parameter is required when configType is set to collectorTargetInstance. |
| └userName | String | No | elastic | The username used to access the output instance specified for the collector. Default value: elastic. This parameter is required when configType is set to collectorTargetInstance or collectorElasticsearchForKibana. |
| └password | String | No | ***** | The password of the username. |
| └enableMonitoring | Boolean | No | true | Specifies whether to enable Monitoring. This parameter is required when configType is set to collectorTargetInstance and instanceType is set to elasticsearch. Valid values: true (enables Monitoring) and false (does not enable Monitoring). |
| └hosts | List | No | ["es-cn-nif201i*****.elasticsearch.aliyuncs.com:9200"] | The list of access addresses of the output instance specified for the collector. This parameter is required when configType is set to collectorTargetInstance. |
| └host | String | No | es-cn-nif201ihd0012****-kibana.internal.elasticsearch.aliyuncs.com:5601 | The private network access address of Kibana after Kibana Dashboard is enabled. This parameter is required when configType is set to collectorElasticsearchForKibana. |
| └kibanaHost | String | No | https://es-cn-nif201ihd0012****.kibana.elasticsearch.aliyuncs.com:5601 | The public network access address of Kibana after Kibana Dashboard is enabled. This parameter is required when configType is set to collectorElasticsearchForKibana. |
└ indicates a child parameter.
extendConfigs includes three configType values: collectorTargetInstance, collectorElasticsearchForKibana, and collectorDeployMachine. The parameters to be configured vary based on the deployment machine. The specific combinations are as follows:
-
collectorTargetInstance
ECS configType, instanceId, instanceType, hosts, userName, password, protocol, and enableMonitoring
ACK configType, instanceId, instanceType, userName, password, protocol, and enableMonitoring
-
collectorElasticsearchForKibana
ECS configType, instanceId, host, kibanaHost, userName, password, and protocol
ACK configType
-
collectorDeployMachine
ECS configType, type, machines, and groupId
ACK configType, type, and instanceId
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
8466BDFB-C513-4B8D-B4E3-5AB256AB**** |
| Result |
object |
The returned result. |
|
| resId |
string |
The ID of the created collector. |
ct-cn-4135is2tj194p**** |
Examples
Success response
JSON format
{
"RequestId": "8466BDFB-C513-4B8D-B4E3-5AB256AB****",
"Result": {
"resId": "ct-cn-4135is2tj194p****"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.