Uninstall the agent
Remove the agent with the public uninstall script or the on-host helper. Server deletion behaves differently on v0.1.0 and v0.2.2.
Updated Nov 7, 2026
On this page
Manual uninstall#
Warning: These commands remove the CloudStats agent, its systemd units, configuration under /etc/cloudstats, and local buffered metrics under /var/lib/cloudstats. They do not delete the server or its metric history in your CloudStats account. Delete the server in the CloudStats website if you want it removed there.
Public one-liner (no token in the URL):
curl -fsSL https://install.cloudstats.me/uninstall.sh | sudo shIf the helper is already on the machine:
sudo /usr/local/lib/cloudstats/uninstall.shBoth run the same static script. It requires root, makes no network calls, and ignores extra arguments except informational --reason. It is idempotent. It:
- Disables and stops
cloudstats-agent.service,cloudstats-agent-uninstall.path, andcloudstats-agent-update.path(errors ignored) - Removes
/usr/local/bin/cloudstats-agent,.new, and.prev - Removes the systemd unit files
- Removes
/usr/local/lib/cloudstats,/etc/cloudstats, and/var/lib/cloudstats - Reloads systemd and prints a short summary
GET /uninstall.sh is public and cacheable. The current installer also embeds this helper on the host.
v0.1.0 versus v0.2.2#
| v0.1.0 | v0.2.2 (current installer) | |
|---|---|---|
/usr/local/lib/cloudstats/uninstall.sh | Not installed | Installed |
https://install.cloudstats.me/uninstall.sh | Not served by that release’s installer | Served |
| systemd uninstall path unit | Not installed | Installed (PathExists=/var/lib/cloudstats/server-deleted) |
RestartPreventExitStatus=87 | Not in the v0.1.0 unit | Present |
| Manual removal if the helper is missing | Stop and disable cloudstats-agent, then delete /usr/local/bin/cloudstats-agent, /etc/cloudstats, /var/lib/cloudstats, and /etc/systemd/system/cloudstats-agent.service, then systemctl daemon-reload | Prefer the helper above |
You can still fetch today’s uninstall.sh from https://install.cloudstats.me/uninstall.sh onto a v0.1.0 host. That current script removes the paths listed above; v0.1.0 never created the extra unit names, and the script ignores missing units.
When you delete the server in CloudStats#
Deleting the server in the website revokes the agent credential. Ingest then returns HTTP 401 with code server_deleted for that credential.
v0.2.2#
The agent does not uninstall on a single server_deleted response.
After at least 5 authenticated server_deleted responses spanning at least 15 minutes, with no successful (accepted) send in between, the agent:
- Logs an error with
server_id - Deletes
/var/lib/cloudstats/wal - Writes
/var/lib/cloudstats/server-deleted - Exits 87 so systemd does not restart it
The uninstall path unit then runs uninstall.sh --reason server-deleted and removes the files unless you opted out.
A successful accepted batch resets the local evidence. Network errors, 5xx, 429, and a plain 401 without code=server_deleted neither count nor reset that evidence.
If /var/lib/cloudstats/server-deleted already exists at startup, the agent logs it and exits 87 immediately.
v0.1.0#
v0.1.0 does not recognize server_deleted. A 401 is treated as a rejected credential. The agent keeps running, retries with backoff, and does not write server-deleted or uninstall itself. Remove it with the manual steps above, or install v0.2.2 and then uninstall.
Opt out of uninstall-on-delete#
Create this file as root:
/etc/cloudstats/no-self-uninstallIf that file exists, a oneshot with --reason server-deleted only stops and disables the agent and keeps the files. The SSH / curl one-liner still removes everything.
