Uninstalling the Server Scout Agent

Removing the Server Scout agent from your Linux server is a straightforward process that can be accomplished either through the built-in uninstall command or manually. This guide covers both methods to ensure complete removal of the monitoring agent.

Using the Built-in Uninstall Command

The Server Scout agent includes a convenient uninstall command that handles all removal tasks automatically. This is the recommended method for most installations.

Prerequisites

  • Root or sudo access to the server
  • The server must be running a recent version of the Scout agent

Running the Uninstall Command

  1. Log in to your server as root or a user with sudo privileges
  1. Execute the uninstall command:

``bash sudo /opt/scout-agent/scout-agent.sh --uninstall ``

  1. The system will prompt for confirmation before proceeding. Type y or yes to confirm the removal

What the Uninstall Process Does

The automated uninstall performs several cleanup tasks:

  • Stops the scout-agent systemd service immediately
  • Disables the service to prevent it from starting on boot
  • Removes the service file located at /etc/systemd/system/scout-agent.service
  • Reloads the systemd daemon to recognise the service removal
  • Completely removes the /opt/scout-agent/ directory, including:

- Configuration files - Spool directories - Installed plugins - Agent binaries and scripts

Manual Uninstall Process

If you're running an older version of the Scout agent that doesn't include the --uninstall flag, or if the automated process fails, you can remove the agent manually.

Step-by-Step Manual Removal

  1. Stop the Scout agent service:

``bash sudo systemctl stop scout-agent ``

  1. Disable the service to prevent automatic startup:

``bash sudo systemctl disable scout-agent ``

  1. Remove the systemd service file:

``bash sudo rm /etc/systemd/system/scout-agent.service ``

  1. Reload the systemd daemon:

``bash sudo systemctl daemon-reload ``

  1. Remove the entire Scout agent directory:

``bash sudo rm -rf /opt/scout-agent ``

Verifying Complete Removal

After running either the automated or manual uninstall process, it's important to verify that the agent has been completely removed.

Check Service Status

Confirm that the systemd service is no longer recognised:

systemctl status scout-agent

You should see output indicating that the service is not found, such as:

Unit scout-agent.service could not be found.

Verify Directory Removal

Ensure the Scout agent directory has been completely removed:

ls -la /opt/scout-agent

This command should return an error message indicating that the directory doesn't exist:

ls: cannot access '/opt/scout-agent': No such file or directory

Dashboard Considerations

After uninstalling the agent, the server will appear as "offline" in your Server Scout dashboard. This is expected behaviour, as the agent is no longer running to send monitoring data.

Removing the Server from Your Dashboard

The uninstall process only removes the agent from your server—it doesn't automatically delete the server from your Server Scout dashboard. To complete the removal:

  1. Log in to your Server Scout dashboard at serverscout.ie
  2. Navigate to your servers list
  3. Locate the offline server
  4. Delete the server entry through the web interface

This final step ensures your dashboard remains tidy and accurately reflects your current monitoring setup.

Troubleshooting

If you encounter permission errors during uninstall, ensure you're running the commands with appropriate privileges using sudo. If files seem to persist after removal, double-check that no Scout agent processes are still running with ps aux | grep scout-agent before attempting removal again.

Frequently Asked Questions

How do I uninstall the Server Scout agent from my Linux server?

Run the command `sudo /opt/scout-agent/scout-agent.sh --uninstall` for automated removal. This built-in uninstall command stops the service, removes all files, and cleans up the systemd configuration. You'll need root or sudo access and will be prompted to confirm the removal.

What happens when I uninstall the Scout agent?

The uninstall process stops the scout-agent systemd service, disables it from starting on boot, removes the service file, and completely deletes the /opt/scout-agent/ directory including configuration files, plugins, and binaries. Your server will appear as offline in the ServerScout dashboard.

How do I manually remove Scout agent if the uninstall command doesn't work?

Stop the service with `sudo systemctl stop scout-agent`, disable it with `sudo systemctl disable scout-agent`, remove the service file with `sudo rm /etc/systemd/system/scout-agent.service`, reload systemd with `sudo systemctl daemon-reload`, and delete the directory with `sudo rm -rf /opt/scout-agent`.

How can I verify the Scout agent was completely removed?

Check that the service is gone by running `systemctl status scout-agent` which should return 'Unit scout-agent.service could not be found'. Also verify the directory is removed with `ls -la /opt/scout-agent` which should show 'No such file or directory'.

What should I do about my server in the ServerScout dashboard after uninstalling?

The server will appear as offline in your dashboard after uninstalling the agent. To complete the removal, log in to your ServerScout dashboard at serverscout.ie, navigate to your servers list, locate the offline server, and delete the server entry through the web interface.

What if I get permission errors when trying to uninstall Scout agent?

Ensure you're running the uninstall commands with appropriate privileges using sudo. If files persist after removal, check that no Scout agent processes are still running with `ps aux | grep scout-agent` before attempting removal again.

Was this article helpful?