これは、なにをしたくて書いたもの?
OpenTelemetry Collector(Contrib)を使う時、ふだんはtar.gzアーカイブをダウンロードして使っているのですが
そういえばdebパッケージ(もしくはrpmパッケージ)のようなOSパッケージの提供形態もあったなと思って
試してみることにしました。
OpenTelemetry Collectorのインストール
OpenTelemetry Collectorのインストールページはこちらです。
Install the Collector | OpenTelemetry
OSパッケージを使ったインストール方法について書いているのはこちらです。
配布元はOpenTelemetry CollectorのReleasesページになります。
GitHub - open-telemetry/opentelemetry-collector-releases: OpenTelemetry Collector Official Releases
ここでは、以下の4つのディストリビューションをビルド・配布しているようです。
- OpenTelemetry Collector
- OpenTelemetry Collector Contrib
- OpenTelemetry Collector for Kubernetes
- OpenTelemetry Collector OTLP
- OpenTelemetry Collector eBPF Profiler
OpenTelemetry Collector OTLPとはなんだろう?と思ったのですが、扱えるプロトコルはOTLP(http/protobuf、gRPC)のみで
Jaegerなどを含まない非常に小さいディストリビューションのようです。
パッケージの元は、それぞれこちら。
- https://github.com/open-telemetry/opentelemetry-collector-releases/tree/v0.131.1/distributions/otelcol
- https://github.com/open-telemetry/opentelemetry-collector-releases/tree/v0.131.1/distributions/otelcol-contrib
- https://github.com/open-telemetry/opentelemetry-collector-releases/tree/v0.131.1/distributions/otelcol-k8s
- https://github.com/open-telemetry/opentelemetry-collector-releases/tree/v0.131.1/distributions/otelcol-otlp
- https://github.com/open-telemetry/opentelemetry-collector-releases/tree/v0.131.1/distributions/otelcol-ebpf-profiler
ディストリビューションといえば、こちらにもページがありますね。
今回はUbuntu Linux 24.04 LTSにdebパッケージでインストールしてみます。
環境
今回の環境はこちら。
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.2 LTS Release: 24.04 Codename: noble $ uname -srvmpio Linux 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
OpenTelemetry Collectorをdebパッケージからインストールする
debパッケージは、OpenTelemetry Collectorのリリースリポジトリーからダウンロードできます。
Releases · open-telemetry/opentelemetry-collector-releases · GitHub
今回はOpenTelemetry Collector ContribとOpenTelemetry Collector、OpenTelemetry Collector OTLPの3つをインストールしてみます。
OpenTelemetry Collector Contribのインストール
ダウンロード。
$ curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.131.1/otelcol-contrib_0.131.1_linux_amd64.deb
インストール。
$ sudo dpkg -i otelcol-contrib_0.131.1_linux_amd64.deb
パッケージの中身を確認してみます。
$ dpkg -L otelcol-contrib /etc /etc/otelcol-contrib /etc/otelcol-contrib/config.yaml /etc/otelcol-contrib/otelcol-contrib.conf /lib diverted by base-files to: /lib.usr-is-merged /lib/systemd /lib/systemd/system /lib/systemd/system/otelcol-contrib.service /usr /usr/bin /usr/bin/otelcol-contrib
systemdのユニット定義ファイルも含まれるようですね。
/lib/systemd/system/otelcol-contrib.service
[Unit] Description=OpenTelemetry Collector Contrib After=network.target [Service] EnvironmentFile=/etc/otelcol-contrib/otelcol-contrib.conf ExecStart=/usr/bin/otelcol-contrib $OTELCOL_OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed Restart=on-failure Type=simple User=otelcol-contrib Group=otelcol-contrib [Install] WantedBy=multi-user.target
設定ファイルも見てみましょう。
/etc/otelcol-contrib/otelcol-contrib.conf
# Systemd environment file for the otelcol-contrib service # Command-line options for the otelcol-contrib service. # Run `/usr/bin/otelcol-contrib --help` to see all available options. OTELCOL_OPTIONS="--config=/etc/otelcol-contrib/config.yaml"
/etc/otelcol-contrib/config.yaml
# To limit exposure to denial of service attacks, change the host in endpoints below from 0.0.0.0 to a specific network interface. # See https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md#safeguards-against-denial-of-service-attacks extensions: health_check: pprof: endpoint: 0.0.0.0:1777 zpages: endpoint: 0.0.0.0:55679 receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 opencensus: endpoint: 0.0.0.0:55678 # Collect own metrics prometheus: config: scrape_configs: - job_name: 'otel-collector' scrape_interval: 10s static_configs: - targets: ['0.0.0.0:8888'] jaeger: protocols: grpc: endpoint: 0.0.0.0:14250 thrift_binary: endpoint: 0.0.0.0:6832 thrift_compact: endpoint: 0.0.0.0:6831 thrift_http: endpoint: 0.0.0.0:14268 zipkin: endpoint: 0.0.0.0:9411 processors: batch: exporters: debug: verbosity: detailed service: pipelines: traces: receivers: [otlp, opencensus, jaeger, zipkin] processors: [batch] exporters: [debug] metrics: receivers: [otlp, opencensus, prometheus] processors: [batch] exporters: [debug] logs: receivers: [otlp] processors: [batch] exporters: [debug] extensions: [health_check, pprof, zpages]
標準、という感じですね。
ちなみに、インストールした時点で起動していたりします。
$ sudo systemctl status otelcol-contrib
● otelcol-contrib.service - OpenTelemetry Collector Contrib
Loaded: loaded (/usr/lib/systemd/system/otelcol-contrib.service; enabled; preset: enabled)
Active: active (running) since Sun 2025-08-03 00:01:58 JST; 3min 38s ago
Main PID: 2132 (otelcol-contrib)
Tasks: 9 (limit: 9486)
Memory: 31.9M (peak: 32.7M)
CPU: 929ms
CGroup: /system.slice/otelcol-contrib.service
└─2132 /usr/bin/otelcol-contrib --config=/etc/otelcol-contrib/config.yaml
Aug 03 00:05:28 server otelcol-contrib[2132]: -> DataType: Gauge
Aug 03 00:05:28 server otelcol-contrib[2132]: NumberDataPoints #0
Aug 03 00:05:28 server otelcol-contrib[2132]: Data point attributes:
Aug 03 00:05:28 server otelcol-contrib[2132]: -> service.instance.id: Str(79723544-9762-4c12-9fa3-7aa6a19f58a3)
Aug 03 00:05:28 server otelcol-contrib[2132]: -> service.name: Str(otelcol-contrib)
Aug 03 00:05:28 server otelcol-contrib[2132]: -> service.version: Str(0.131.1)
Aug 03 00:05:28 server otelcol-contrib[2132]: StartTimestamp: 1970-01-01 00:00:00 +0000 UTC
Aug 03 00:05:28 server otelcol-contrib[2132]: Timestamp: 2025-08-02 15:05:28.468 +0000 UTC
Aug 03 00:05:28 server otelcol-contrib[2132]: Value: 40457480.000000
Aug 03 00:05:28 server otelcol-contrib[2132]: {"resource": {"service.instance.id": "79723544-9762-4c12-9fa3-7aa6a19f58a3", "service.name": "otelcol-contrib", "serv>
OpenTelemetry Collectorのインストール
ダウンロード。
$ curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.131.1/otelcol_0.131.1_linux_amd64.deb
インストール。
$ sudo dpkg -i otelcol_0.131.1_linux_amd64.deb
パッケージの中身。
$ dpkg -L otelcol /etc /etc/otelcol /etc/otelcol/config.yaml /etc/otelcol/otelcol.conf /lib diverted by base-files to: /lib.usr-is-merged /lib/systemd /lib/systemd/system /lib/systemd/system/otelcol.service /usr /usr/bin /usr/bin/otelcol
こちらもsystemdのユニット定義が含まれています。
/lib/systemd/system/otelcol.service
[Unit] Description=OpenTelemetry Collector After=network.target [Service] EnvironmentFile=/etc/otelcol/otelcol.conf ExecStart=/usr/bin/otelcol $OTELCOL_OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed Restart=on-failure Type=simple User=otel Group=otel [Install] WantedBy=multi-user.target
設定ファイル。
/etc/otelcol/otelcol.conf
# Systemd environment file for the otelcol service # Command-line options for the otelcol service. # Run `/usr/bin/otelcol --help` to see all available options. OTELCOL_OPTIONS="--config=/etc/otelcol/config.yaml"
/etc/otelcol/config.yaml
# To limit exposure to denial of service attacks, change the host in endpoints below from 0.0.0.0 to a specific network interface. # See https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md#safeguards-against-denial-of-service-attacks extensions: health_check: pprof: endpoint: 0.0.0.0:1777 zpages: endpoint: 0.0.0.0:55679 receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 opencensus: endpoint: 0.0.0.0:55678 # Collect own metrics prometheus: config: scrape_configs: - job_name: 'otel-collector' scrape_interval: 10s static_configs: - targets: ['0.0.0.0:8888'] jaeger: protocols: grpc: endpoint: 0.0.0.0:14250 thrift_binary: endpoint: 0.0.0.0:6832 thrift_compact: endpoint: 0.0.0.0:6831 thrift_http: endpoint: 0.0.0.0:14268 zipkin: endpoint: 0.0.0.0:9411 processors: batch: exporters: debug: verbosity: detailed service: pipelines: traces: receivers: [otlp, opencensus, jaeger, zipkin] processors: [batch] exporters: [debug] metrics: receivers: [otlp, opencensus, prometheus] processors: [batch] exporters: [debug] logs: receivers: [otlp] processors: [batch] exporters: [debug] extensions: [health_check, pprof, zpages]
config.yamlはOpenTelemetry Collector Contribのものと同じでしたね。
インストールすると起動しているのもの同じです。
$ sudo systemctl status otelcol
● otelcol.service - OpenTelemetry Collector
Loaded: loaded (/usr/lib/systemd/system/otelcol.service; enabled; preset: enabled)
Active: active (running) since Sun 2025-08-03 00:10:25 JST; 2s ago
Main PID: 2815 (otelcol)
Tasks: 9 (limit: 9486)
Memory: 15.5M (peak: 16.1M)
CPU: 53ms
CGroup: /system.slice/otelcol.service
└─2815 /usr/bin/otelcol --config=/etc/otelcol/config.yaml
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.456+0900 info otlpreceiver@v0.131.0/otlp.go:175 Starting HTTP server {"resource": {"s>
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.457+0900 info prometheusreceiver@v0.131.0/metrics_receiver.go:157 Starting discovery manager>
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info targetallocator/manager.go:218 Scrape job added {"resource": {"service.>
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info prometheusreceiver@v0.131.0/metrics_receiver.go:216 Starting scrape manager >
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info jaegerreceiver@v0.131.0/trace_receiver.go:211 Starting UDP server for Binary T>
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info jaegerreceiver@v0.131.0/trace_receiver.go:233 Starting UDP server for Compact >
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info jaegerreceiver@v0.131.0/trace_receiver.go:337 Starting HTTP server for Jaeger >
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info jaegerreceiver@v0.131.0/trace_receiver.go:362 Starting gRPC server for Jaeger >
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info healthcheck/handler.go:131 Health Check state change {"resource": {"ser>
Aug 03 00:10:25 server otelcol[2815]: 2025-08-03T00:10:25.458+0900 info service@v0.131.0/service.go:299 Everything is ready. Begin running and process>
OpenTelemetry Collector OTLP
ダウンロード。
$ curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.131.1/otelcol-otlp_0.131.1_linux_amd64.deb
インストール。
$ sudo dpkg -i otelcol-otlp_0.131.1_linux_amd64.deb
パッケージに含まれているファイル。
$ dpkg -L otelcol-otlp /etc /etc/otelcol-otlp /etc/otelcol-otlp/otelcol-otlp.conf /lib diverted by base-files to: /lib.usr-is-merged /lib/systemd /lib/systemd/system /lib/systemd/system/otelcol-otlp.service /usr /usr/bin /usr/bin/otelcol-otlp
systemdのユニット定義ファイル。
/lib/systemd/system/otelcol-otlp.service
[Unit] Description=OpenTelemetry Collector OTLP After=network.target [Service] EnvironmentFile=/etc/otelcol-otlp/otelcol-otlp.conf ExecStart=/usr/bin/otelcol-otlp $OTELCOL_OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed Restart=on-failure Type=simple User=otelcol-otlp Group=otelcol-otlp [Install] WantedBy=multi-user.target
設定ファイル。
/etc/otelcol-otlp/otelcol-otlp.conf
# Systemd environment file for the otelcol-otlp service # Command-line options for the otelcol-otlp service. # Run `/usr/bin/otelcol-otlp --help` to see all available options. # Note: No default config file is provided at the path below, one must be created. OTELCOL_OPTIONS="--config=/etc/otelcol-otlp/config.yaml"
こちらのパッケージには、config.yamlは含まれていないようです。
systemdのユニットとしても起動していません。
$ sudo systemctl status otelcol-otlp
○ otelcol-otlp.service - OpenTelemetry Collector OTLP
Loaded: loaded (/usr/lib/systemd/system/otelcol-otlp.service; enabled; preset: enabled)
Active: inactive (dead)
おわりに
Ubuntu Linux 24.04 LTSに各種OpenTelemetry Collectorをインストールしてみました。
ディストリビューションの種類がいろいろあるのを知りましたが、そのうち自分でもビルドしてみたいですね。