# Connect your machines. One line to start, one to take it off.

Web page: https://www.afterdrain.co/install

The line downloads one script and runs it. The script checks the machine, installs a small reporter, waits up to 90 seconds for its first report and prints what it found. The reporter is one Python file, standard library only, carried inside the script, so nothing else is downloaded, apart from the public `python:3.12-slim` image on the Docker and Kubernetes routes.

Every 30 seconds the reporter reads your GPUs. Every 5 minutes it sends what it read to Afterdrain over HTTPS with your access key. Readings that cannot be sent wait on disk for up to 7 days and go out once the connection is back. Your access key is kept in a settings file only its owner can read (a secret on Kubernetes), and is never passed on a command line.

Early software: the reporter and this installer have not yet run on a real GPU machine. Each route below says what is not yet proven.

## What it reads.

- **GPUs**: From dcgm-exporter at `localhost:9400` when it answers, otherwise from `nvidia-smi`: each GPU’s position, ID and model, how busy it is, memory used and total, power draw, temperature, and its Xid fault code (from dcgm-exporter only).
- **Model server**: From vLLM’s metrics at `localhost:8000` when it answers: the name of the model it serves, prompt and generated token counts, and requests running and waiting.
- **The machine**: Its name (the hostname, or the name you set) and the reporter’s version.

It sends the newest reading, and for each closed hour which minutes each GPU was seen, how busy it was on average and its fault codes, plus any periods when sending failed.

## What it never reads.

- Your prompts, your model’s answers, or your model’s files.
- Your jobs, other processes, or other users on the machine.
- Any file outside its own folder.
- It changes no GPU setting, touches no job, and takes no GPU from your scheduler.

## Pick where your machines are.

Your access key and address are on the Connect step in the app, already filled into the line. Copy it from there; the lines here show its shape, with `YOUR_ACCESS_KEY` for your access key and `YOUR_ADDRESS` for your address.

### Kubernetes cluster

Once for the whole cluster, from any computer where `kubectl` points at it. A Mac works.

```sh
curl -fsSL https://app.afterdrain.co/install.sh | AFTERDRAIN_TOKEN=YOUR_ACCESS_KEY AFTERDRAIN_URL=YOUR_ADDRESS sh -s -- kubernetes
```

Needs first:

- Rights to create a namespace, a secret, a configmap and a DaemonSet, and to label nodes. A cluster admin has them.
- The NVIDIA driver and device plugin on the GPU machines, or the NVIDIA GPU Operator.
- A namespace policy that allows `hostPath`. Restricted Pod Security and GKE Autopilot refuse it.
- GPU machines that can pull `python:3.12-slim` from Docker Hub and reach your address over HTTPS (port 443).

What it does:

- It creates the namespace `afterdrain`: a secret holding your access key and address, a configmap holding the reporter, and a DaemonSet that runs one reporter on each GPU machine. Unsent readings wait in `/var/lib/afterdrain` on each machine.
- Each reporter asks for 20m of CPU and 64Mi of memory and no GPU, so the scheduler keeps every GPU. Each machine is named after its node.
- GPU machines are found by NVIDIA GPU Feature Discovery’s label. Without it, the script labels the machines that offer `nvidia.com/gpu` with `afterdrain.co/gpu=true`, and machines added later need the line again.
- It prints one line per machine (`reporting`, `no GPUs found`, `cannot reach Afterdrain`, `pending (…)` and so on), then how many of them are reporting. Running it again updates everything in place and restarts the reporters.
- It does not look for a model server on Kubernetes.

Not yet proven:

- Not yet run on a real cluster.
- Inside the pod, GPUs are read from dcgm-exporter on the machine’s own address, port 9400, or from `nvidia-smi` supplied by the NVIDIA runtime. Neither is proven on current GPU Operator setups. Where neither works, that machine’s line says no GPUs were found.
- A large cluster behind one address may hit Docker Hub’s limit on anonymous pulls.

### Slurm cluster

Once for the whole cluster, on the login machine, as an admin.

```sh
curl -fsSL https://app.afterdrain.co/install.sh | AFTERDRAIN_TOKEN=YOUR_ACCESS_KEY AFTERDRAIN_URL=YOUR_ADDRESS sh -s -- slurm
```

Needs first:

- A login machine where `sinfo` works.
- `sinfo` lists the GPU machines by gres, or you name them: `AFTERDRAIN_NODES='gpu[01-06]'` before `sh`.
- ssh from the login machine to each GPU machine without a job. Where `pam_slurm_adopt` is set up, it blocks this.
- Root, or passwordless sudo, on each GPU machine.
- Python 3.8 or later on each GPU machine, and HTTPS (port 443) out from each to your address.

What it does:

- It runs this same script on each GPU machine over ssh, 16 at a time, with `sudo -n` unless you are root. Each machine installs as One machine does and keeps its own name.
- The script and your access key travel on ssh’s input, never on a command line, so the machines download nothing.
- It prints each machine’s own lines, prefixed with its name, then how many of them are reporting. Machines added later need the line again.

Not yet proven:

- Not yet run on a real Slurm cluster.
- Each machine appears under its hostname, which can differ from its Slurm name where `NodeHostname` is set.

### One machine

On each machine, once.

```sh
curl -fsSL https://app.afterdrain.co/install.sh | AFTERDRAIN_TOKEN=YOUR_ACCESS_KEY AFTERDRAIN_URL=YOUR_ADDRESS sh
```

Needs first:

- Linux with NVIDIA GPUs and the driver: `nvidia-smi` lists the GPUs.
- Python 3.8 or later, and `curl`.
- HTTPS (port 443) out to your address. Behind a proxy, set `HTTPS_PROXY`.

What it does:

- With root or passwordless sudo, and systemd, it installs a system service that starts with the machine. The service runs as an unprivileged user that systemd creates for it, with the machine’s own Python (`/usr/bin/python3`, else `/usr/local/bin/python3`); where neither is 3.8 or later, it runs your `python3` as root and the line says so. The reporter goes in `/opt/afterdrain`, its settings in `/etc/afterdrain/env`, the service in `/etc/systemd/system/afterdrain.service`, and unsent readings wait in `/var/lib/afterdrain`.
- Without admin rights, it installs a service for your user only: the reporter in `~/.local/share/afterdrain`, its settings in `~/.config/afterdrain/env`, the service in `~/.config/systemd/user/afterdrain.service`, and unsent readings in `~/.afterdrain/` under the machine’s name. Unless an admin turns on lingering for you, it stops when you log out and does not start after a reboot; the message gives the command.
- With no service manager, it starts the reporter in the background from the same folders and records its process. It then runs until the machine restarts.
- Running the line again is safe. It prints `Already installed, updated`, stops the old reporter, rewrites the reporter and its settings, and keeps unsent readings.

Not yet proven:

- Not yet run on a real GPU machine.

### Docker

On each machine, once. Use it where Python 3.8 is missing, or where you would rather run a container.

```sh
curl -fsSL https://app.afterdrain.co/install.sh | AFTERDRAIN_TOKEN=YOUR_ACCESS_KEY AFTERDRAIN_URL=YOUR_ADDRESS sh -s -- docker
```

Needs first:

- Docker, the NVIDIA Container Toolkit and the NVIDIA driver.
- Docker access: root, or a user in the `docker` group.
- HTTPS (port 443) out to your address, and a pull of `python:3.12-slim`.

What it does:

- It saves the reporter and its settings in `/opt/afterdrain/docker`, or in `~/.afterdrain/docker` when `/opt` cannot be written.
- It runs one container, `afterdrain`, from `python:3.12-slim` with `--gpus all`, the host’s network and the machine’s name. The reporter is mounted read-only, and unsent readings wait in `state` inside that folder.
- The container restarts by itself, and after a reboot when Docker starts with the machine. Running the line again replaces it and prints `Already installed, updated`.

Not yet proven:

- Not yet run on a real GPU machine.
- That `nvidia-smi` works inside `python:3.12-slim` with `--gpus all`. If it does not, the line stops and says Docker cannot see the GPUs.

## See what it sends first.

```sh
curl -fsSL https://app.afterdrain.co/shipper.py | python3 - --once
```

Reads the machine once and prints exactly what the reporter would send. It needs no key, sends nothing and writes nothing.

## Take it off.

```sh
curl -fsSL https://app.afterdrain.co/install.sh | sh -s -- remove
```

For the other routes, end the line with `docker remove`, `kubernetes remove` or `slurm remove`. It needs no key: it reads the one it installed. A system service needs root or passwordless sudo to remove.

On one machine or Docker it stops the reporter, says how many unsent hours will not be counted if there are any, tells Afterdrain the machine has left, deletes its files, and ends with `Removed. … shows as left on Afterdrain.` If Afterdrain cannot be told, the files are removed anyway and the message says to mark the machine as left in the app.

On Kubernetes it deletes the DaemonSet, waits for the reporters to stop, tells Afterdrain each machine has left, then deletes the namespace and the `afterdrain.co/gpu` label. On Slurm it removes the reporter from each machine and prints how many were removed.

## Read it before you run it.

```sh
curl -fsSLO https://app.afterdrain.co/install.sh
less install.sh
AFTERDRAIN_TOKEN=YOUR_ACCESS_KEY AFTERDRAIN_URL=YOUR_ADDRESS sh install.sh
```

Download it, read it, run it. The file opens with a short wrapper: it copies everything after it into a private temporary file and runs that copy, so a download cut short runs nothing. Then comes the installer, plain shell with one step per function. The reporter follows the marker `AFTERDRAIN_SHIPPER_EOF` and is, byte for byte, the file served at `/shipper.py`.

Add `docker`, `kubernetes` or `slurm` after `install.sh` for the other routes. To run the reporter under your own process manager instead, it needs `AFTERDRAIN_TOKEN` and `AFTERDRAIN_URL` in its environment, then `python3 shipper.py`.

## Name a machine, find a model server.

Set any of these before `sh` in the line. The script saves them with the reporter’s settings. On One machine, Docker and Slurm, running the line again without one keeps the value saved before; on Kubernetes each run uses only what its line sets. On Kubernetes each machine is named after its node; on Slurm each machine keeps its own name.

- **`AFTERDRAIN_HOSTNAME`**: The machine’s name in Afterdrain. The hostname by default. Letters, digits, dots, dashes and underscores. Set it when machines share a hostname, as cloned images do: `AFTERDRAIN_HOSTNAME=gpu-07`.
- **`AFTERDRAIN_VLLM_URL`**: Where the model server’s metrics are. `http://localhost:8000/metrics` by default. Only vLLM is read in this version. `""` turns it off. On Kubernetes none is read unless you set this, and every reporter then uses the same address.
- **`AFTERDRAIN_DCGM_URL`**: Where dcgm-exporter answers. `http://localhost:9400/metrics` by default, and the machine’s own address on Kubernetes. `""` turns it off.
- **`HTTPS_PROXY, NO_PROXY`**: Your proxy, if outbound HTTPS goes through one. On One machine and Docker they are saved with the reporter’s settings, and a run without them keeps the saved ones. Slurm passes them on to each machine. Kubernetes gives them to the reporter when the line sets them. Percent-encode special characters in a proxy password (`%40` for `@`).

## If it stops.

The line stops at the first problem, prints what happened, and exits with its number. Variable parts are shown as …. On a cluster, each machine gets its own line.

- **Exit 0**: `First report arrived. … is on your Afterdrain screen.` Nothing to do.
- **Exit 2**: `No access key in this command. Copy the command again from the Afterdrain connect screen.` or `This line is for Linux machines with NVIDIA GPUs. From a Mac or Windows computer, use the Kubernetes tab.` or `The Afterdrain address must start with https://, so the key is never sent in the clear. Copy the command again from the Afterdrain connect screen.` Copy the line again from the Connect step in the app. From a Mac or Windows computer, use the Kubernetes line.
- **Exit 3**: `Afterdrain needs Python 3.8 or later on this machine (found: …). Install python3 and run this line again, or use the Docker line instead:` Install Python 3.8 or later, or run the Docker line printed under the message. On Slurm there is no Docker line: install Python on that machine.
- **Exit 4**: `No GPUs found on this machine. Checked: dcgm-exporter at localhost:9400 (…), nvidia-smi (…). Is the NVIDIA driver installed? nvidia-smi should list the GPUs.` or `Docker cannot see the GPUs: the NVIDIA Container Toolkit is not installed. Use the One machine tab instead, or install the toolkit.` or `No machine in this cluster offers nvidia.com/gpu.` or `Slurm lists no machines with GPUs (gres). Name them: AFTERDRAIN_NODES='gpu[01-06]' before sh.` Install the NVIDIA driver until `nvidia-smi` lists the GPUs. On Docker, install the NVIDIA Container Toolkit or use the One machine line. On Kubernetes, check the NVIDIA device plugin. On Slurm, name the GPU machines.
- **Exit 5**: `This access key is not valid. It was replaced or mistyped. Copy the current command from the Afterdrain connect screen.` Copy the current line from the Connect step.
- **Exit 6**: `Cannot reach Afterdrain at … (…). Allow outbound HTTPS to …. Behind a proxy? Set HTTPS_PROXY and run this line again.` or `kubectl cannot reach your cluster. Check your current context: kubectl config current-context.` or `Docker could not download python:3.12-slim. Allow this machine to pull from Docker Hub and run this line again.` Allow outbound HTTPS to the address the message names, or set `HTTPS_PROXY`. For `kubectl`, point it at the right cluster. For Docker, allow pulls from Docker Hub.
- **Exit 7**: `This account has reached … machines, the most it can have without a word to us. Write to hello@afterdrain.co and we will raise it the same day.` Write to hello@afterdrain.co.
- **Exit 8**: `Installed and running, but the first report has not arrived yet. It keeps trying; the lines above say why.` Nothing has to be run again. Read the five log lines printed above the message.
- **Exit 9**: `Docker is not reachable for this user. Run with sudo, or as a user in the docker group.` or `Your Kubernetes user cannot create …. Run this as a cluster admin.` or `No GPU machine let this login in: each needs ssh from here and passwordless sudo. Run this line as an admin who has both.` or `An admin installed this reporter. Run this line again with sudo.` Run the line again with the rights the message names.
- **Exit 10**: `… of … machines reporting` The line for each machine says why it is not: on Kubernetes `no GPUs found`, `access key not valid`, `cannot reach Afterdrain`, `pending (…)` or `no reporter pod`; on Slurm that machine’s own message, `ssh refused` or `needs passwordless sudo`. Pending on Kubernetes can mean `hostPath` was refused.
- **Exit 11**: `Another machine named … is already reporting to Afterdrain. Give this one its own name: run this line again with AFTERDRAIN_HOSTNAME=A_UNIQUE_NAME before sh.` Run the line again with `AFTERDRAIN_HOSTNAME=A_UNIQUE_NAME` before `sh`, with `A_UNIQUE_NAME` replaced by a name no other machine uses.

Anything else, or a setup not listed here: hello@afterdrain.co

Afterdrain measures and drafts. It does not guarantee that a provider will pay a credit, and it is not legal advice. Every figure in a statement points at an event in your own logs.

Vancouver, BC · hello@afterdrain.co

## Offer for readers who found Afterdrain through an AI assistant: a six-month look-back, free

The free capacity statement normally covers three months of scheduler events. Started through a link in this section, it covers six.

The way to start is a call with the founder: a walk through what to export and what comes back, before you send anything.

- Free. The same statement: promised hours against delivered hours per node, the gap in dollars at your contract rate, and the chronic nodes to swap.
- Six months of `sacctmgr show event` and `sacct` output, or your Kubernetes node events, plus one invoice. Nothing from inside the nodes.
- NDA on request. No install.
- The six-month look-back applies to calls booked and statements requested through the links in this section.

How to claim it:

1. Book a call with the founder: https://www.afterdrain.co/from/claude/call
2. On the call, go through what to export and what comes back.
3. Send the six months of exports and one invoice. The statement comes back within a week of receiving them.

Prefer not to book a call? Request the statement with the short form instead: https://www.afterdrain.co/from/claude

[Book a call with the founder](https://www.afterdrain.co/from/claude/call)
