Watchflare docs
Sur cette page
Cette page n'est pas encore disponible en français. Vous lisez la version anglaise.

Uninstall the Watchflare Agent

Fully remove the Watchflare agent from Linux or macOS — stops the service, removes binary and config files, with optional data and user cleanup.

sudo watchflare-agent uninstall

Linux

The uninstall command is interactive. It stops and removes the service, deletes the binary, and asks separately whether to remove the data directory, config directory, log file, and system user:

bash
sudo watchflare-agent uninstall
=== Watchflare Agent Uninstallation ===

[1/6] Checking permissions...
  → Running as root
[2/6] Removing service...
[3/6] Removing binary...
[4/6] Data and configuration...
Remove data directory (/var/lib/watchflare)? (y/N):
Remove configuration directory (/etc/watchflare)? (y/N):
[5/6] Log files...
Remove log file (/var/log/watchflare-agent.log)? (y/N):
[6/6] System user...
Remove system user 'watchflare'? (y/N):

What each prompt controls:

| Prompt | What it removes | Answer N to… | |--------|----------------|--------------| | Data directory | WAL file, package state | Keep metrics buffer intact | | Config directory | agent.conf, ca.pem | Preserve registration credentials | | Log file | /var/log/watchflare-agent.log | Keep logs for troubleshooting | | System user | watchflare system user | Keep if reinstalling soon |

Answering N to the config directory preserves agent.conf and ca.pem. If you reinstall the agent on this host later with the same agent_id and agent_key, it will reconnect to the Hub without a new registration.

Note

The host is not automatically removed from the Hub after uninstalling the agent. It will appear as offline on the Hosts page. Delete it manually if you no longer need it.

Verify removal on Linux

Check that no files remain:

bash
which watchflare-agent           # should return nothing
ls /etc/watchflare 2>/dev/null   # should not exist (if you answered Y)
ls /var/lib/watchflare 2>/dev/null
systemctl status watchflare-agent 2>/dev/null

macOS

Stop the service and uninstall via Homebrew:

bash
brew services stop watchflare-agent
brew uninstall watchflare-agent

To also remove config and data files:

bash
rm -rf $(brew --prefix)/etc/watchflare
rm -rf $(brew --prefix)/var/watchflare
rm -f  $(brew --prefix)/var/log/watchflare-agent.log

Verify removal on macOS

bash
which watchflare-agent                              # should return nothing
ls $(brew --prefix)/etc/watchflare 2>/dev/null     # should not exist
brew services list | grep watchflare               # should return nothing

Remove the host from the dashboard

Uninstalling the agent does not remove the host from the Hub. To delete it:

  1. Open the host's detail page in the dashboard.
  2. Click the menu → Delete host.

Deleting the host removes all its metrics history, package inventory, and alert rules from the database.


Re-enroll the same host

If you want to reinstall the agent on this host without going through a new registration:

  1. Answer N to all data/config removal prompts during uninstall (Linux), or skip the rm -rf commands (macOS).
  2. Reinstall the agent binary.
  3. The agent will reconnect using the saved agent_id, agent_key, and ca.pem — no new registration token needed.

If you removed the config directory, you will need to create a new host in the dashboard and run the register command with a fresh token.