For the complete documentation index, see llms.txt. Markdown versions are available by appending .md to documentation URLs.

Docker Swarm OpenTelemetry Collection Agent - Install

SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

This guide explains how to install the Docker Swarm Collection Agent on a Docker Swarm with Foundry.

Prerequisites

  • An active Docker Swarm. The agent runs one copy on every node of the Swarm, so every node needs Linux and Docker Engine 25.0 or newer.
  • A shell on a manager node of the Swarm, where you run the commands in this guide. foundryctl cast deploys the agent with docker stack deploy, which runs only on a manager node.
  • Ports 4317 and 4318 free on every node. To run the agent on a Swarm that runs self-hosted SigNoz, see Run on the same Swarm as self-hosted SigNoz.
  • A SigNoz to send data to: SigNoz Cloud or a self-hosted SigNoz.

Install the Collection Agent

Step 1: Install foundryctl

Run this on a manager node:

curl -fsSL https://signoz.io/foundry.sh | bash

For manual install (Windows PowerShell, air-gapped, etc.) or PATH setup, see the foundry getting-started guide.

Step 2: Create casting.yaml

Create a file named casting.yaml on the manager node, with one document for the agent described in How it works:

casting.yaml
apiVersion: v1alpha1
kind: CollectionAgent
metadata:
  name: signoz
spec:
  deployment:
    mode: docker
    flavor: swarm
  collector:
    spec:
      env:
        SIGNOZ_INGESTION_ENDPOINT: https://ingest.<region>.signoz.cloud:443
        SIGNOZ_INGESTION_KEY: <your-ingestion-key>
        OTEL_RESOURCE_ATTRIBUTES: deployment.environment=<your-environment>
      config:
        data:
          collector/agent/agent.yaml: |
            exporters:
              otlphttp/signoz:
                headers:
                  signoz-ingestion-key: ${env:SIGNOZ_INGESTION_KEY}

Verify these values:

  • <region>: Your SigNoz Cloud region.
  • <your-ingestion-key>: Your SigNoz Cloud ingestion key.
  • <your-environment>: Your deployment environment, for example staging or production.

For every option of this casting, see the Docker Swarm example.

Step 3: Deploy

Run this from the directory that contains casting.yaml:

foundryctl cast -f casting.yaml

This command:

  • writes the stack file compose.yaml to pours/collectionagent/ and the collector config agent.yaml to pours/collectionagent/collector/agent/;
  • deploys compose.yaml with docker stack deploy, as the stack signoz;
  • runs the agent as the service signoz_collector-agent, with one task on every node.

Run the same command again after editing casting.yaml. A changed collector config becomes a new Swarm config, and Swarm replaces the agent's tasks to use it.

Step 4: Verify the Collection Agent

Run this on the manager node to check that the agent started:

docker service logs signoz_collector-agent

The logs should include a line similar to the following from each node, where task IDs and node names vary:

signoz_collector-agent.0.qij0plduzksw@node-1    | ... Everything is ready. Begin running and processing data.

docker service ps signoz_collector-agent lists one Running task per node. In SigNoz, open Infrastructure Monitoring > Hosts: each node appears under its host name as data arrives. Check Logs Explorer to confirm container logs are flowing.

Customize the Collection Agent

Every change follows the same loop: edit casting.yaml, then run foundryctl cast -f casting.yaml again.

  • Collector settings (image, environment): set them in the collector's spec (see spec fields). For example, to pin the collector image:

    spec:
      collector:
        spec:
          image: otel/opentelemetry-collector-contrib:0.139.0
  • Collector config (receivers, processors, pipelines): add it under spec.collector.spec.config.data, keyed collector/agent/agent.yaml. It merges into the generated config (see custom config files). For example, to collect host metrics every 30s:

    spec:
      collector:
        spec:
          config:
            data:
              collector/agent/agent.yaml: |
                receivers:
                  hostmetrics:
                    collection_interval: 30s
  • Stack file (mounts, placement, memory limit): add patches under spec.patches against collectionagent/compose.yaml. For example, to mount the node's /var/log into the agent:

    spec:
      patches:
        - target: collectionagent/compose.yaml
          operations:
            - op: add
              path: /services/collector-agent/volumes/-
              value:
                type: bind
                source: /var/log
                target: /var/log
                read_only: true

    Take the target and paths from the files under pours/. Each run regenerates them, so keep every change in casting.yaml.

Troubleshooting

foundryctl cast stops with tools are not available

In Step 3, foundryctl cast -f casting.yaml stops with tools are not available, please install them and try again: docker-swarm.

Cause: the machine is not a manager node of an active Swarm. Run the command with --debug to see which: docker swarm is not active or current node is a swarm worker, not a manager.

Fix: run Step 3 on a manager node. To create a Swarm on this machine, run docker swarm init first.

After the fix, foundryctl cast -f casting.yaml deploys the stack, and docker service logs signoz_collector-agent shows Everything is ready.

A port conflict stops the agent

In Step 3, foundryctl cast -f casting.yaml stops with port '4317' is already in use by service '<service>' (<id>) as an ingress port. Or in Step 4, docker service logs signoz_collector-agent stays empty, and docker service ps --no-trunc signoz_collector-agent shows tasks Pending with host-mode port already in use on 1 node, or Failed with failed to bind host port 0.0.0.0:4317/tcp: address already in use or Bind for 0.0.0.0:4317 failed: port is already allocated.

Cause: something else holds port 4317 or 4318:

  • as an ingress port: another service publishes it through the Swarm routing mesh, such as the ingester of self-hosted SigNoz.
  • host-mode port already in use: another Swarm service publishes it in host mode on that node.
  • address already in use or port is already allocated: a container or process outside the Swarm holds it on that node, such as the Docker Collection Agent or a self-hosted SigNoz run with Docker Compose.

Fix: for self-hosted SigNoz on the Swarm, give the agent its own name and ports as Run on the same Swarm as self-hosted SigNoz shows, then run Step 3 again. Otherwise, stop what holds the port on that node. Swarm then starts the waiting tasks on its own.

After the fix, docker service logs signoz_collector-agent shows Everything is ready.

The agent logs at least one endpoint must be specified

In Step 4, docker service logs signoz_collector-agent shows exporters::otlphttp/signoz: at least one endpoint must be specified, and the agent's tasks keep restarting.

Cause: the casting sets no SIGNOZ_INGESTION_ENDPOINT under spec.collector.spec.env.

Fix: add it as in Step 2, then run foundryctl cast -f casting.yaml again from the directory that contains it.

After the fix, docker service logs signoz_collector-agent shows Everything is ready.

foundryctl cast rejects a patch

foundryctl cast -f casting.yaml stops before it deploys the agent, with failed to apply patch for target "<target>" followed by one of these:

  • patch target "<target>" did not match any generated material
  • doc is missing path: <path>: missing value
  • doc is missing key: <path>: missing value
  • unable to remove nonexistent key: <key>: missing value

Cause: the patch's target or path does not exist in what Foundry generates.

Fix: remove the patch, then run this from the directory that contains casting.yaml:

foundryctl forge -f casting.yaml

Take the target and path from the files under pours/collectionagent/, add the patch back, then run foundryctl cast -f casting.yaml again.

After the fix, docker service logs signoz_collector-agent shows Everything is ready.

Send data from your applications

Host metrics, container metrics, and container logs flow as soon as the agent is running. To send traces, metrics, and logs from your applications through the agent, see Send Data from Applications to the Collector.

Next Steps

Is this page helpful

Last updated—October 26, 2026