2. Unistall Server Agent

Guide for uninstalling the Monitoring Agent (your .deb packaged agent) with different scenarios explained:


Stop and Disable the Service

sudo systemctl stop monitoring-agent
sudo systemctl disable monitoring-agent
  • Ensures the agent is not running anymore.

  • disable prevents it from starting on boot.


Remove vs. Purge

There are two main ways to uninstall Debian packages:

  1. Remove (keep configuration files)

    sudo dpkg -r monitoring-agent
    • Removes the package binaries, but keeps configs in /etc/monitoring-agent/ (if you had any).

    • Useful if you plan to reinstall and keep previous settings.

  2. Purge (remove everything)

    sudo dpkg -P monitoring-agent
    • Completely removes binaries and configuration files.

    • Use this if you want a fresh clean uninstall.

Optional Cleanup

If logs or runtime data are stored outside the package (e.g., in /var/lib/monitoring-agent/ or /var/log/monitoring-agent/), you may want to remove them manually:

sudo rm -rf /var/lib/monitoring-agent
sudo rm -rf /var/log/monitoring-agent
sudo rm -rf /etc/monitoring-agent

With this, you can:

  • Stop and disable the service.

  • Remove or purge the package depending on whether you want to keep configs.

Last updated