To remove the metrics agent, remove the do-agent package and all associated configuration files like this:
sudo apt-get purge do-agent
A prompt appears if apt finds the do-agent package and is ready to remove it and its configuration files. When prompted, type Y, and then press ENTER.
The following packages will be REMOVED:
do-agent*
...
After this operation, 13.1 MB disk space will be freed.
Do you want to continue? [Y/n]
After you confirm, the output shows that the system removed the agent, deleted its configuration, and cleaned up related services. Warnings about stopping or disabling the service mean the service wasn’t running at the time of removal.
Removing do-agent (3.17.1) ...
...
Removed '/etc/systemd/system/multi-user.target.wants/do-agent.service'.
...
Purging configuration files for do-agent (3.17.1) ...
...
Failed to stop do-agent.service: Unit do-agent.service not loaded.
Failed to disable unit: Unit do-agent.service does not exist
If you installed the agent using the metrics agent repository, also remove the repository configuration:
sudo rm /etc/apt/sources.list.d/digitalocean-agent.list
This command produces no output if it succeeds. To confirm that the repository file was removed, run:
test -f /etc/apt/sources.list.d/digitalocean-agent.list && echo "Repo still exists" || echo "Repo successfully removed"
If the removal was successful, the command returns:
Repo successfully removed
To remove the metrics agent, remove the do-agent package from your system:
A prompt appears if yum finds the do-agent package and is ready to remove it. When prompted, type Y, and then press ENTER:
Package Arch Version Repository Size
Removing:
do-agent x86_64 3.17.1-1 sonar 12.5 MiB
...
Transaction Summary:
Removing: 1 package
...
Is this ok [y/N]:
After you confirm, the output shows that the system removed the agent from your Droplet:
Running transaction
...
[2/2] Erasing do-agent-0:3.17.1-1.x86_64 100% | ... | ... | ...
Complete!
If you installed the agent using the metrics agent repository, remove the repository configuration by deleting the YUM repository file:
sudo rm /etc/yum.repos.d/digitalocean-agent.repo
This command produces no output if it succeeds. To confirm that the repository file was removed, run:
test -f /etc/yum.repos.d/digitalocean-agent.repo && echo "Repo still exists" || echo "Repo successfully removed"
If the removal was successful, the command returns:
Repo successfully removed