Uninstalling the Agent
Complete guide for removing the StatusRadar monitoring agent from your servers.
Quick Uninstall
The simplest way to uninstall the agent:
curl -s https://statusradar.dev/install-agent.sh | sudo bash -s uninstall
This command will:
- Stop the agent service
- Disable the systemd service
- Remove the service file
- Delete the agent directory (
/opt/statusradar
) - Delete the log directory (
/var/log/statusradar
) - Remove virtual environment (if used)
Before Uninstalling
Data Retention
Important: Uninstalling the agent does NOT delete:
- Historical monitoring data on StatusRadar platform
- Server record in your dashboard
- Alert history and configurations
To completely remove the server:
- Uninstall the agent (this guide)
- Log in to StatusRadar dashboard
- Navigate to Servers → Your Server → Settings
- Click "Delete Server" button
Alternatives to Uninstalling
Consider these options before completely removing the agent:
Option 1: Temporarily stop the agent
sudo systemctl stop statusradar-agent
Option 2: Disable auto-start (keep files)
sudo systemctl stop statusradar-agent
sudo systemctl disable statusradar-agent
Option 3: Reduce collection frequency
Edit /opt/statusradar/config.env
:
INTERVAL=3600 # Check every hour instead of 5 minutes
Then restart:
sudo systemctl restart statusradar-agent
Complete Uninstallation
Automatic Uninstall (Recommended)
Run the uninstall command:
curl -s https://statusradar.dev/install-agent.sh | sudo bash -s uninstall
What happens:
- Stops
statusradar-agent
service - Disables service from auto-start
- Removes
/etc/systemd/system/statusradar-agent.service
- Reloads systemd daemon
- Removes virtual environment at
/opt/statusradar/venv
(if exists) - Removes installation directory
/opt/statusradar
- Removes log directory
/var/log/statusradar
Expected output:
→ Uninstalling StatusRadar agent...
→ Stopping service...
→ Disabling service...
✓ Service removed
→ Removing virtual environment...
✓ Installation directory removed
✓ Log directory removed
✓ Agent uninstalled successfully
StatusRadar agent has been completely removed from your system.
Manual Uninstallation
For step-by-step control:
Step 1: Stop the service
sudo systemctl stop statusradar-agent
Step 2: Disable the service
sudo systemctl disable statusradar-agent
Step 3: Remove systemd service file
sudo rm -f /etc/systemd/system/statusradar-agent.service
sudo systemctl daemon-reload
Step 4: Remove agent directory
sudo rm -rf /opt/statusradar
Step 5: Remove log directory
sudo rm -rf /var/log/statusradar
Step 6: Verify removal
# Check service is gone
systemctl status statusradar-agent
# Should show: "Unit statusradar-agent.service could not be found"
# Check files are removed
ls -la /opt/statusradar
# Should show: "No such file or directory"
Backup Before Uninstall
If you might want to reinstall later with the same configuration:
# Backup configuration
sudo cp /opt/statusradar/config.env ~/statusradar-config-backup.env
# Or backup entire directory
sudo tar czf ~/statusradar-backup.tar.gz /opt/statusradar
# Then uninstall
curl -s https://statusradar.dev/install-agent.sh | sudo bash -s uninstall
To restore later:
# Reinstall agent
TOKEN='your-token' bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)"
# Restore configuration
sudo cp ~/statusradar-config-backup.env /opt/statusradar/config.env
# Restart with old config
sudo systemctl restart statusradar-agent
Verification
Verify Complete Removal
Check 1: Service not found
sudo systemctl status statusradar-agent
Expected: Unit statusradar-agent.service could not be found
Check 2: Files removed
ls /opt/statusradar
ls /var/log/statusradar
Expected: No such file or directory
Check 3: No processes running
ps aux | grep statusradar
Should only show the grep command itself
Check 4: Systemd service file removed
ls /etc/systemd/system/statusradar-agent.service
Expected: No such file or directory
Verify on Dashboard
After uninstalling:
- Your server will show as "Offline" on the dashboard
- Historical data remains visible
- Optionally delete the server record from Settings
Python Dependencies
System Packages (Optional Cleanup)
The uninstall script does NOT remove system Python packages for safety. These packages may be used by other applications:
To check if safe to remove:
# Check what uses psutil
dpkg -S python3-psutil
# Check what uses requests
dpkg -S python3-requests
To manually remove (only if you're sure):
# Ubuntu/Debian
sudo apt-get remove --purge python3-psutil python3-requests python3-urllib3
# CentOS/RHEL
sudo yum remove python3-psutil python3-requests python3-urllib3
Virtual Environment
If the agent used a virtual environment, it's automatically removed during uninstallation at /opt/statusradar/venv
.
Uninstall Multiple Servers
To uninstall from multiple servers:
Create Uninstall Script
#!/bin/bash
# uninstall-agents.sh
SERVERS=(
"web1.example.com"
"web2.example.com"
"db1.example.com"
)
for server in "${SERVERS[@]}"; do
echo "Uninstalling agent on $server..."
ssh root@$server "curl -s https://statusradar.dev/install-agent.sh | bash -s uninstall"
echo "---"
done
echo "All agents uninstalled"
Run Batch Uninstall
chmod +x uninstall-agents.sh
./uninstall-agents.sh
Troubleshooting Uninstallation
Service Won't Stop
Error: Failed to stop service
# Force kill the process
sudo pkill -9 -f statusradar-agent
# Then remove service
sudo rm -f /etc/systemd/system/statusradar-agent.service
sudo systemctl daemon-reload
Cannot Remove Directory
Error: Device or resource busy
# Check what's using the directory
sudo lsof +D /opt/statusradar
# Kill processes
sudo pkill -9 -f statusradar
# Try again
sudo rm -rf /opt/statusradar
Permission Denied
# Use sudo for all removal commands
sudo rm -rf /opt/statusradar
sudo rm -rf /var/log/statusradar
sudo rm -f /etc/systemd/system/statusradar-agent.service
Service Still Listed After Removal
# Reload systemd
sudo systemctl daemon-reload
# Reset failed state
sudo systemctl reset-failed
# Verify
systemctl list-units --all | grep statusradar
After Uninstallation
Remove Server from Dashboard
- Log in to StatusRadar Dashboard
- Go to Servers
- Click on your server
- Go to Settings tab
- Scroll to "Danger Zone"
- Click Delete Server
- Confirm deletion
This will delete:
- Server record
- All historical metrics
- All alerts for this server
- Plugin configurations
Export Data Before Deletion
If you want to keep historical data:
# Export via API (if you have API access)
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
"https://api.statusradar.dev/v1/servers/SERVER_ID/metrics/export" \
> server-metrics.json
Reinstallation
Fresh Installation
If you want to reinstall later:
TOKEN='your-token' bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)"
With Previous Configuration
If you backed up your config:
# Install agent
TOKEN='your-token' bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)"
# Restore config
sudo cp ~/statusradar-config-backup.env /opt/statusradar/config.env
# Restart
sudo systemctl restart statusradar-agent
Getting Help
If you encounter issues during uninstallation:
- Try manual uninstallation steps
- Check logs:
sudo journalctl -u statusradar-agent -n 100
- Force remove files:
sudo rm -rf /opt/statusradar
- Contact support: [email protected]
Next Steps
- Installation Guide - Reinstall if needed
- Upgrading Guide - Update instead of uninstall
- Troubleshooting Guide - Fix issues before removing
- Quick Uninstall
- Before Uninstalling
- Data Retention
- Alternatives to Uninstalling
- Complete Uninstallation
- Automatic Uninstall (Recommended)
- Manual Uninstallation
- Backup Before Uninstall
- Verification
- Verify Complete Removal
- Verify on Dashboard
- Python Dependencies
- System Packages (Optional Cleanup)
- Virtual Environment
- Uninstall Multiple Servers
- Create Uninstall Script
- Run Batch Uninstall
- Troubleshooting Uninstallation
- Service Won't Stop
- Cannot Remove Directory
- Permission Denied
- Service Still Listed After Removal
- After Uninstallation
- Remove Server from Dashboard
- Export Data Before Deletion
- Reinstallation
- Fresh Installation
- With Previous Configuration
- Getting Help
- Next Steps