Call the CreateCollector to create a collector.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. After you call an operation, OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request header

This operation uses only the common request header. For more information, see Common request parameters.

Request structure


     POST /openapi/collectors HTTP/1.1 
   

Request parameters

Parameter Type Position Required Example Description
clientToken String Query No 5A2CFF0E-5718-45B5-9D4D-70B3FF****

This parameter is used to ensure the idempotence of the request. The value of this parameter is generated by the client and is unique among different requests. The maximum length is 64 ASCII characters.

RequestBody

The following parameters must be filled in the RequestBody to specify the configuration information of the collector to be created.

Parameter

Type

Required

Example

Description

dryRun

Boolean

Yes

true

Whether to verify and create a collector is used only when creating or updating a collector. Optional values: true (only check but not update), false (check and update).

name

String

Yes

ct-test

The name of the collector.

resType

String

Yes

fileBeat

The collector type. Optional values: fileBeat, metricBeat, heartBeat, and auditBeat.

resVersion

String

Yes

6.8.5_with_community

The collector version.

vpcId

Integer

Yes

vpc-bp12nu14urf0upaf*****

Virtual Private Cloud ID. where the collector is located

collectorPaths

List<String>

No

["/var/log"]

The fileBeat collection path. Only when the installation machine of the collector is ECS, configuration is required.

configs

List

Yes

The configuration file information of the collector.

└fileName

String

Yes

filebeat.yml

The name of the file.

└content

String

Yes

"filebeat.inputs:xxx"

The content of the remote file.

extendConfigs

Array

Collector expansion configuration.

└configType

String

Yes

collectorElasticsearchForKibana

The type of the configuration. Optional values: collectorTargetInstance (collector Output), collectorDeployMachine (collector's deployment machine), collector Elasticsearch ForKibana (Elasticsearch instance information supporting Kibana dashboard).

└type

String

No

ECSInstanceId

The type of machine that the collector is deployed. Optional values: ECSInstanceId(ECS), ACKCluster (Container Kubernetes). Required when the configType is collectorDeployMachine.

└instanceType

String

No

elasticsearch

The instance type specified by the collector Output. Optional value: Elasticsearch , logstash. Required when the configType is collectorTargetInstance.

└instanceId

String

Yes

es-cn-nif201ihd0012****

The instance ID associated with the collector. When the configType is collectorTargetInstance, the instance ID of collector Output; When the configType is collectorDeployMachines and the type is ACKCluster, it is ACK cluster ID.

└machines

Array

An array of node roles.

The list of ECS machines deployed by the collector. Required when the configType is collectorDeployMachines and the type is ECSInstanceId.

└└instanceId

String

Yes

i-bp11u91xgubypcuz****

The list of ECS machine IDs.

└groupId

String

default_ct-cn-5i2l75bz4776****

The ID of the host group. Required when the configType is collectorDeployMachine.

└protocol

String

No

HTTP

The transmission protocol needs to be consistent with the access protocol of the instance specified by the collector Output. Optional values: HTTP, HTTPS. Required when the configType is collectorTargetInstance.

└userName

String

No

elastic

Output specifies the user name of the instance. The default name is elastic. Required when the configType is collectorTargetInstance or collectorElasticsearchForKibana.

└password

String

No

*****

The password of the corresponding username.

└enableMonitoring

Boolean

No

true

Whether to enable Monitoring is required when the configType is collectorTargetInstance and the instanceType is Elasticsearch. Optional values: true (enabled) and false (not enabled).

└hosts

List<String>

No

["es-cn-nif201i*****.elasticsearch.aliyuncs.com:9200"]

Collector Output specifies the list of access addresses of the instance. Required when the configType is 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. Required when the configType is collectorElasticsearchForKibana.

└kibanaHost

String

No

https://es-cn-nif201ihd0012****.kibana.elasticsearch.aliyuncs.com:5601

The Internet access address of Kibana after Kibana Dashboard is enabled. Required when the configType is collectorElasticsearchForKibana.

Note └ indicates a child parameter.

Special parameter description

extendConfigs There are three configType types, namely, collectorTargetInstance, collectorElasticsearchForKibana and collectorDeployMachine. The deployment machines are different and the parameters to be configured are different. The specific combination method is as follows:

  • 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

Response parameters

Parameter Type Example Description
RequestId String 8466BDFB-C513-4B8D-B4E3-5AB256AB****

The ID of the request.

Result Struct

The returned results.

resId String ct-cn-4135is2tj194p****

The ID of the successfully created collector.

Examples

Sample requests


     POST /openapi/collectors HTTP/1.1 public request header {"dryrun": false, "name": "test_mufei_1", "resType": "fileBeat", "resVersion": "6.8.5_with_community", "vpcId": "vpc-bp12nu14urf0upaf*****", "collectorPaths": [ "/var/log" ], "extendConfigs": [ { "instanceId": "es-cn-nif201ihd0012****", "instanceType": "elasticsearch", "configType": "collectorTargetInstance", "hosts": [ "es-cn-nif201ihd0012****.elasticsearch.aliyuncs.com:9200" ], "userName": "elastic", "password": "*****", "protocol": "HTTP" }, { "type": "ECSInstanceId", "configType": "collectorDeployMachine", "machines": [ { "instanceId": "i-bp11u91xgubypcuz****" } ] } ], "configs": [ { "fileName": "filebeat.yml", "content": "filebeat.inputs:xxx" }, { "fileName": "fields.yml", "content": "- key: log\n title: Log file content\n description: >\n Contains log file lines.\n ...." } ] } 
   

Sample success responses

JSON format


     { "Result": { "resId": "ct-cn-4135is2tj194p****" }, "RequestId": "8466BDFB-C513-4B8D-B4E3-5AB256AB****" } 
   

Error codes

For a list of error codes, visit the API Error Center.