How to remove Sensu-go-agent completely from the system

Hi,
How can I remove sensu from a Ubuntu or Debian system?
I ran apt remove --purge sensu-go-agent but I still have some folders and the service running

Thanks

Hey there, an apt purge should be completely removing the Sensu bits from the system. Since it’s not, here are the default paths for the agent and the backend:

Backend

dpkg -c sensu-go-backend_6.9.1-6928_amd64.deb
drwxr-xr-x root/root         0 2022-12-01 17:01 ./etc/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./etc/sensu/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/sbin/
-rwxr-xr-x root/root  42176512 2022-12-01 16:54 ./usr/sbin/sensu-backend
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/doc/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/doc/sensu-go-backend-6.9.1/
-r--r--r-- root/root       100 2022-12-01 16:55 ./usr/share/doc/sensu-go-backend-6.9.1/LICENSE.txt
-r--r--r-- root/root        82 2022-12-01 17:01 ./usr/share/doc/sensu-go-backend-6.9.1/README.txt
-rw-r--r-- root/root      1772 2022-12-01 16:55 ./usr/share/doc/sensu-go-backend-6.9.1/backend.yml.example
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/sensu-go-backend-6.9.1/
-rw-r--r-- root/root      4174 2022-12-01 16:55 ./usr/share/sensu-go-backend-6.9.1/sensu-backend
-rw-r--r-- root/root       605 2022-12-01 16:55 ./usr/share/sensu-go-backend-6.9.1/sensu-backend.service
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/cache/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/cache/sensu/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/cache/sensu/sensu-backend/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/lib/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/lib/sensu/
drwxr-x--- root/root         0 2022-12-01 17:01 ./var/lib/sensu/sensu-backend/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/log/
drwxr-x--- root/root         0 2022-12-01 17:01 ./var/log/sensu/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/run/
drwxr-x--- root/root         0 2022-12-01 17:01 ./var/run/sensu/

Agent

dpkg -c sensu-go-agent_6.9.1-6928_amd64.deb
drwxr-xr-x root/root         0 2022-12-01 17:01 ./etc/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./etc/sensu/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/sbin/
-rwxr-xr-x root/root  20123648 2022-12-01 16:54 ./usr/sbin/sensu-agent
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/doc/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/doc/sensu-go-agent-6.9.1/
-r--r--r-- root/root       100 2022-12-01 16:55 ./usr/share/doc/sensu-go-agent-6.9.1/LICENSE.txt
-r--r--r-- root/root        80 2022-12-01 17:01 ./usr/share/doc/sensu-go-agent-6.9.1/README.txt
-rw-r--r-- root/root      1348 2022-12-01 16:55 ./usr/share/doc/sensu-go-agent-6.9.1/agent.yml.example
drwxr-xr-x root/root         0 2022-12-01 17:01 ./usr/share/sensu-go-agent-6.9.1/
-rw-r--r-- root/root      4146 2022-12-01 16:55 ./usr/share/sensu-go-agent-6.9.1/sensu-agent
-rw-r--r-- root/root       560 2022-12-01 16:55 ./usr/share/sensu-go-agent-6.9.1/sensu-agent.service
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/cache/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/cache/sensu/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/cache/sensu/sensu-agent/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/lib/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/lib/sensu/
drwxr-x--- root/root         0 2022-12-01 17:01 ./var/lib/sensu/sensu-agent/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/log/
drwxr-x--- root/root         0 2022-12-01 17:01 ./var/log/sensu/
drwxr-xr-x root/root         0 2022-12-01 17:01 ./var/run/
drwxr-x--- root/root         0 2022-12-01 17:01 ./var/run/sensu/

Removing all of those files should completely purge Sensu from your system.