Upgrading the Agent
Keep your StatusRadar monitoring agent up-to-date with the latest features, bug fixes, and security patches.
Quick Update
The simplest way to update your agent:
curl -s https://statusradar.dev/install-agent.sh | sudo bash -s update
Or with your token:
bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)" update
The update script automatically:
- Stops the running agent
- Backs up the current version
- Downloads the latest agent
- Updates all plugins
- Restarts the service
When to Update
Regular Updates
Update your agent:
- Monthly - For latest features and improvements
- On security advisories - Critical security patches
- Before adding new plugins - Ensure plugin compatibility
- After system upgrades - Verify compatibility with new OS
Check Current Version
# View agent file modification date
ls -lh /opt/statusradar/statusradar-agent.py
# Check agent logs for version info
sudo journalctl -u statusradar-agent -n 20 --no-pager | grep "Agent"
Update Process
Automatic Update (Recommended)
Step 1: Run the update command
sudo bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)" update
What happens:
- Checks if agent is installed at
/opt/statusradar
- Stops
statusradar-agent
service - Backs up current agent to
/opt/statusradar/statusradar-agent.py.backup
- Downloads latest version as
/opt/statusradar/statusradar-agent.py.new
- Replaces agent file
- Downloads latest plugins to
/opt/statusradar/plugins/
- Restarts the service
Step 2: Verify the update
# Check service is running
sudo systemctl status statusradar-agent
# View recent logs
sudo journalctl -u statusradar-agent -n 50 --no-pager
Expected output:
● statusradar-agent.service - StatusRadar Server Monitoring Agent
Active: active (running)
Manual Update
For more control over the update process:
# 1. Stop the agent
sudo systemctl stop statusradar-agent
# 2. Backup current agent
sudo cp /opt/statusradar/statusradar-agent.py \
/opt/statusradar/statusradar-agent.py.backup
# 3. Download latest version
sudo curl -sL https://statusradar.dev/agent/statusradar-agent.py \
-o /opt/statusradar/statusradar-agent.py
# 4. Make executable
sudo chmod +x /opt/statusradar/statusradar-agent.py
# 5. Update plugins (if using any)
cd /opt/statusradar/plugins
sudo curl -sL https://statusradar.dev/agent/plugins/redis_plugin.py \
-o redis_plugin.py
# ... repeat for other plugins
# 6. Restart agent
sudo systemctl start statusradar-agent
# 7. Check status
sudo systemctl status statusradar-agent
Updating Plugins
Plugins are automatically updated when you run the update script. To update specific plugins manually:
Update Single Plugin
cd /opt/statusradar/plugins
# Update Redis plugin
sudo curl -sL https://statusradar.dev/agent/plugins/redis_plugin.py \
-o redis_plugin.py
# Update MySQL plugin
sudo curl -sL https://statusradar.dev/agent/plugins/mysql_plugin.py \
-o mysql_plugin.py
# Restart agent to load new plugin
sudo systemctl restart statusradar-agent
Update All Plugins
# Re-run installer with current PLUGINS setting
PLUGINS='redis,mysql,nginx' \
bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)" update
Configuration Preservation
Your Configuration is Safe
The update process preserves:
/opt/statusradar/config.env
- Your API token and plugin settings- Plugin configurations
- Systemd service configuration
The update process replaces:
/opt/statusradar/statusradar-agent.py
- Main agent script/opt/statusradar/plugins/*.py
- Plugin files
Verify Configuration After Update
# Check your config is intact
cat /opt/statusradar/config.env | grep API_TOKEN
# Verify plugins are configured
cat /opt/statusradar/config.env | grep PLUGINS
Rollback
If the update causes issues, you can rollback to the previous version:
# Stop the new version
sudo systemctl stop statusradar-agent
# Restore backup
sudo mv /opt/statusradar/statusradar-agent.py.backup \
/opt/statusradar/statusradar-agent.py
# Restart service
sudo systemctl start statusradar-agent
# Verify rollback
sudo systemctl status statusradar-agent
Troubleshooting Updates
Update Script Fails
Error: "Agent not installed"
ERROR: Agent not installed. Please run the installer first.
Solution: The agent must be installed before updating:
TOKEN='your-token' bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)"
Agent Won't Start After Update
Check logs for errors:
sudo journalctl -u statusradar-agent -n 100 --no-pager
Common issues:
1. Python dependency issues
# Reinstall dependencies
cd /opt/statusradar
sudo pip3 install -r requirements.txt
# Or if using venv
sudo /opt/statusradar/venv/bin/pip install -r requirements.txt
2. Configuration file issues
# Check config syntax
cat /opt/statusradar/config.env
3. Permission issues
# Fix permissions
sudo chmod +x /opt/statusradar/statusradar-agent.py
sudo chown -R root:root /opt/statusradar
Update Downloaded But Service Won't Restart
# Check service status
sudo systemctl status statusradar-agent
# Check what's preventing start
sudo journalctl -u statusradar-agent -n 50 --no-pager
# Try manual start
cd /opt/statusradar
sudo python3 statusradar-agent.py --token YOUR_TOKEN --once --debug
Best Practices
1. Test Updates on Non-Production First
If you have multiple servers:
- Update one test server first
- Monitor for 24 hours
- Then update production servers
2. Update During Maintenance Windows
- Schedule updates during low-traffic periods
- Have rollback plan ready
- Monitor logs after update
3. Check Dashboard After Update
After updating, verify on StatusRadar dashboard:
- Server shows as "Online"
- Metrics are being collected
- Plugins are reporting data
- No error alerts
4. Keep Backups
The update script creates .backup
files automatically. Keep them for 7 days:
# List backups
ls -lh /opt/statusradar/*.backup
# Clean old backups (older than 7 days)
find /opt/statusradar -name "*.backup" -mtime +7 -delete
Automated Updates
Option 1: Cron Job (Use with Caution)
Only recommended for non-critical environments:
# Edit root crontab
sudo crontab -e
# Add weekly update (Sunday 3 AM)
0 3 * * 0 /bin/bash -c "$(curl -sL https://statusradar.dev/install-agent.sh)" update >> /var/log/statusradar-update.log 2>&1
Option 2: Manual Update Schedule
Safer approach: Set calendar reminder to manually update monthly
# Save this as update-agent.sh
#!/bin/bash
curl -s https://statusradar.dev/install-agent.sh | bash -s update
Run manually when convenient:
sudo bash update-agent.sh
Getting Help
If you encounter issues during update:
- Check logs:
sudo journalctl -u statusradar-agent -n 100
- Rollback: Use the
.backup
file to restore previous version - Manual test: Run agent with
--debug
flag - Contact support: Email [email protected] with error logs
Include This Information
When requesting support:
# System info
uname -a
cat /etc/os-release
# Agent version (backup file date)
ls -lh /opt/statusradar/statusradar-agent.py*
# Service status
sudo systemctl status statusradar-agent --no-pager
# Recent logs
sudo journalctl -u statusradar-agent -n 100 --no-pager
Next Steps
- Configuration Guide - Configure your updated agent
- Troubleshooting Guide - Resolve issues
- Plugin Documentation - Add new plugins
- Uninstallation Guide - If you need to remove the agent
- Quick Update
- When to Update
- Regular Updates
- Check Current Version
- Update Process
- Automatic Update (Recommended)
- Manual Update
- Updating Plugins
- Update Single Plugin
- Update All Plugins
- Configuration Preservation
- Your Configuration is Safe
- Verify Configuration After Update
- Rollback
- Troubleshooting Updates
- Update Script Fails
- Agent Won't Start After Update
- Update Downloaded But Service Won't Restart
- Best Practices
- 1. Test Updates on Non-Production First
- 2. Update During Maintenance Windows
- 3. Check Dashboard After Update
- 4. Keep Backups
- Automated Updates
- Option 1: Cron Job (Use with Caution)
- Option 2: Manual Update Schedule
- Getting Help
- Include This Information
- Next Steps