Skip to content

How to collect telemetry with a sink

The sink collects every runner's logs, job output and metrics on an always-on machine: a runner or any other Linux host. It needs no root once it is set up. These steps assume /usr/local/bin/allmyram is already on that machine. What the sink sees explains what it collects and why.

Add the sink

  1. On the sink machine, create its user and directory. The last line lets you read the telemetry; log in again afterwards.

    sudo useradd --system --home-dir /var/lib/allmyram-sink --no-create-home \
      --shell /usr/sbin/nologin allmyram-sink
    sudo install -d -o allmyram-sink -g allmyram-sink -m 0750 /var/lib/allmyram-sink
    sudo usermod -aG allmyram-sink "$USER"
    
  2. On the laptop, start the invite. It waits for the sink, which has 15 minutes to join.

    allmyram invite --sink
    
  3. On the sink machine, join and paste the invite on stdin. NAME is a DNS label, different from every runner's name. The unit passes the hostname (--name %H), so if NAME is anything else, edit the unit too. join creates the state directory.

    sudo -u allmyram-sink /usr/local/bin/allmyram join --sink --name NAME \
      --state-dir /var/lib/allmyram-sink/state
    
  4. Compare the fingerprint with the laptop's and approve there. Touch ID asks once, to sign the record naming the sink, which the laptop sends to every runner. The laptop prints sink NAME joined, then reached: and the runners that took the record; a runner it couldn't reach is reported on stderr. It then waits up to 2 minutes for the sink's service to take the runner list, so go straight on to the next step.

  5. Install and start the unit from deploy/linux/:

    sudo install -m 0644 allmyram-sink.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable --now allmyram-sink
    
  6. If the invite gave up waiting for the service and warned, run allmyram sync-sink on the laptop to send the runner list.

Telemetry lands in /var/lib/allmyram-sink/data as hourly logs-*.jsonl and metrics-*.jsonl files. The unit keeps 30 days and at most 10 GiB.

Read the telemetry

On the sink, as a member of the allmyram-sink group, with the DuckDB CLI and deploy/linux/sink.sql:

duckdb -init sink.sql
  • from runners; shows each runner's last heartbeat.
  • from jobs(24); shows the jobs that ended in the last 24 hours, by outcome.
  • from usage(24); shows how much idle memory and CPU jobs used.

The other views are run_ends, job_output, runner_logs and metric_points. The file's header has more examples.

Keep the sink's certificate current

The host certificate lasts 30 days and renews when the laptop connects to the sink with under 10 days left: on a runner join or removal, revoke, rotate-client-key and sync-sink. If none of those happened for a while, run allmyram sync-sink. After it has expired, run allmyram renew NAME.

Retire or move the sink

  1. On the laptop: allmyram remove NAME. Touch ID signs a record saying there is no sink, and every runner stops keeping telemetry.
  2. On the old sink: sudo systemctl disable --now allmyram-sink. A sink left running keeps dialing runners, which turn it away; its log warns once per runner that the runner's sink record does not name it.
  3. To move it, add the sink again on the new machine.