Configure an OpenTelemetry Collector to connect to agent management
Configure an OpenTelemetry Collector to connect to agent management
You can connect either the Splunk distribution of the OpenTelemetry Collector or the upstream open-source OpenTelemetry Collector Contrib to agent management. The Splunk distribution already includes the OpAMP extension. If you use the open-source Collector Contrib, the OpAMP extension is also included.
- On your machine prepare a plain text configuration file named
config.yaml. Replace the placeholders for hostname or IP address and token with the data prepared in Configure Splunk Enterprise and turn on OpenTelemetry Collectors.Use the hostname or IP address and management port of agent management you want the collector to connect with.
CODEreceivers: hostmetrics: collection_interval: 10s scrapers: memory: exporters: debug: verbosity: detailed service: pipelines: metrics: receivers: [hostmetrics] exporters: [debug] extensions: [opamp] extensions: opamp: server: http: endpoint: https://<hostname_or_IP>:<management_port>/services/tenant/agent-management/v2/opamp/otel tls: ca_file: /path/to/ca-cert.pem headers: Authorization: Bearer <your_authentication_token>Tip: If you use self-signed certificates, provide the path to your Certificate Authority (CA) file in theca_filefield. Avoid settinginsecure_skip_verify: truein production environments, as it disables certificate verification and exposes the connection to potential man-in-the-middle attacks. Useinsecure_skip_verify: trueonly in development or testing environments. - Copy your file to your target machine using the following command:
CODE
scp config.yaml <user>@<hostname_or_IP>:/home/<user> - Download the OpenTelemetry Collector to your Linux machine.
If you use the Splunk distribution of the OpenTelemetry Collector, see the Splunk OpenTelemetry Collector documentation for installation instructions. The OpAMP extension is already included.
If you use the open-source Collector Contrib, download it from the OpenTelemetry Collector GitHub repository: https://github.com/open-telemetry/opentelemetry-collector-releases/releases.
For example, you can use the following command to download otelcol-contrib_0.124.1_linux_amd64.tar.gz for AMD CPU Architecture:CODEcurl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.124.1/otelcol-contrib_0.124.1_linux_amd64.tar.gz - If you downloaded the open-source Collector Contrib archive, untar the file with the following command:
CODE
tar -xvf otelcol-contrib_0.124.1_linux_amd64.tar.gz - Run the OTel Collector using your configuration file:
CODE
./otelcol-contrib --config=config.yaml - Now, you can see the OTel Collector registered in the agent management. Select Settings and then select OTel Collectors under the Distributed Environment section.
Next step
After you configure and connect OTel Collectors to your Splunk Enterprise instance, you can view them on Splunk Enterprise. See View OpenTelemetry Collectors in Splunk Enterprise