Collector on a VM
This page installs the upstream OpenTelemetry Collector (otelcol-contrib) on a Linux
machine from the official packages. It runs as a systemd service, receives OTLP from
apps on the machine and forwards it to FuseScope.
Use this page when your apps run on a virtual machine or bare-metal server, outside Docker and Kubernetes, or when you want host metrics from that machine.
For why a local collector helps (batching, retries, enrichment, one egress point), see Collector on Docker.
Install
Section titled “Install”Packages are published on the
opentelemetry-collector-releases
page. This example pins 0.139.0 on amd64; use arm64 in the file name for ARM
machines.
curl -fLO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.139.0/otelcol-contrib_0.139.0_linux_amd64.debsudo dpkg -i otelcol-contrib_0.139.0_linux_amd64.debcurl -fLO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.139.0/otelcol-contrib_0.139.0_linux_amd64.rpmsudo rpm -ivh otelcol-contrib_0.139.0_linux_amd64.rpmUse the tarball where no package fits. It contains only the binary: you write the config and run it yourself (or with your own service unit).
curl -fLO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.139.0/otelcol-contrib_0.139.0_linux_amd64.tar.gztar -xzf otelcol-contrib_0.139.0_linux_amd64.tar.gz otelcol-contribsudo install -m 0755 otelcol-contrib /usr/local/bin/otelcol-contrib --config=/etc/otelcol-contrib/config.yamlThe deb and rpm packages set up:
| Item | Value |
|---|---|
| Binary | /usr/bin/otelcol-contrib |
| systemd service | otelcol-contrib, enabled and started on install |
| Config file | /etc/otelcol-contrib/config.yaml (a sample; kept on upgrade) |
| Options file | /etc/otelcol-contrib/otelcol-contrib.conf, sets OTELCOL_OPTIONS |
| User | otelcol-contrib, a system user without a shell |
Configure
Section titled “Configure”Replace the sample /etc/otelcol-contrib/config.yaml. This is the same base config as
on Docker, with OTLP bound to localhost so only apps on this machine can send:
receivers: otlp: protocols: grpc: endpoint: localhost:4317 http: endpoint: localhost:4318
processors: memory_limiter: check_interval: 1s limit_percentage: 80 spike_limit_percentage: 25 batch: {}
exporters: otlphttp: endpoint: http://fusescope-collector.example.com:4318
extensions: health_check: endpoint: localhost:13133
service: extensions: [health_check] pipelines: traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlphttp] metrics: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlphttp] logs: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlphttp]receivers: otlp: protocols: grpc: endpoint: localhost:4317 http: endpoint: localhost:4318
processors: memory_limiter: check_interval: 1s limit_percentage: 80 spike_limit_percentage: 25 batch: {}
exporters: otlp: endpoint: fusescope-collector.example.com:4317 tls: insecure: true
extensions: health_check: endpoint: localhost:13133
service: extensions: [health_check] pipelines: traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlp] metrics: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlp] logs: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlp]- Replace
fusescope-collector.example.comwith your FuseScope collector address; see From outside the cluster. Self-hosted FuseScope needs no ingestion key. - To accept data from other machines, use
0.0.0.0:4317and0.0.0.0:4318, and restrict access with a firewall: the receivers have no authentication. - Point apps on the machine at
http://localhost:4318withOTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf, orhttp://localhost:4317withgrpc.
Command-line flags go in /etc/otelcol-contrib/otelcol-contrib.conf:
OTELCOL_OPTIONS="--config=/etc/otelcol-contrib/config.yaml"The service reads this file as its systemd EnvironmentFile. Variables you add there
are also available in the config as ${env:NAME}.
Run and check
Section titled “Run and check”-
Validate the config:
Terminal window sudo -u otelcol-contrib otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml -
Restart the service and check its state:
Terminal window sudo systemctl restart otelcol-contribsudo systemctl status otelcol-contrib -
Read its logs:
Terminal window sudo journalctl -u otelcol-contrib -fLook for
Everything is ready. Begin running and processing data.Export errors, such asconnection refused, also appear here. -
Check the health endpoint:
Terminal window curl http://localhost:13133/ -
If data still doesn’t show in FuseScope, add the
debugexporter (verbosity: detailed) to a pipeline, restart, and watch the journal to see what the collector receives. See Collector on Docker.
Upgrade
Section titled “Upgrade”Install the newer package the same way. Your config.yaml and otelcol-contrib.conf
are kept, and the service restarts.
Related
Section titled “Related”- Hosts: CPU, memory, disk and network of this machine
- Prometheus metrics
- Collector on Docker
- OTLP endpoints