Skip to content

osercinoglu/watchtower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏗️ Server Watchtower

A powerful web-based server monitoring application that connects to multiple servers via SSH and displays real-time resource usage metrics with beautiful progress bars and responsive UI.

Server Watchtower Python Flask

✨ Features

  • Real-time Monitoring: Monitor CPU, RAM, and disk usage across multiple servers
  • SSH Connection: Secure SSH connections to remote servers (password or key-based auth)
  • Beautiful UI: Modern, responsive interface with progress bars and status indicators
  • Auto-refresh: Automatically refreshes metrics every 30 seconds
  • Connection Testing: Test SSH connections before adding servers
  • Multi-server Support: Monitor unlimited number of servers simultaneously
  • Error Handling: Graceful handling of connection failures and errors

📊 Monitored Metrics

  • CPU Usage: Real-time CPU utilization percentage
  • Memory Usage: RAM usage with total/used capacity
  • Disk Usage: Disk utilization with total/used space
  • Server Status: Online/offline indicators
  • Connection Health: Visual status indicators for each server

🚀 Quick Start

Prerequisites

  • Python 3.8 or higher
  • pip3 package manager
  • SSH access to target servers
  • Linux/Unix target servers (tested on Ubuntu, CentOS, Debian)

Installation

  1. Clone the repository:

    git clone <your-repo-url>
    cd watchtower
  2. Run the startup script:

    ./start.sh

    The script will:

    • Create a virtual environment
    • Install all dependencies
    • Start the Flask server
  3. Access the application: Open your browser and navigate to: http://localhost:5000

Manual Installation

If you prefer manual setup:

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Start the application
cd backend
python app.py

🎮 Usage

Adding a Server

  1. Click the "Add Server" button

  2. Fill in the server details:

    • Server Alias: Friendly name (optional)
    • Host/IP Address: Server IP or hostname
    • SSH Port: Usually 22
    • Username: SSH username
    • Password: SSH password (optional if using key auth)
    • SSH Key Path: Path to private key file (optional)
  3. Click "Test Connection" to verify connectivity

  4. Click "Add Server" to start monitoring

Managing Servers

  • Refresh Individual Server: Click the refresh button on any server card
  • Refresh All Servers: Click "Refresh All" to update all servers
  • Remove Server: Click the trash icon to remove a server
  • Auto-refresh: Servers automatically refresh every 30 seconds

🏗️ Project Structure

watchtower/
├── backend/
│   └── app.py              # Flask application and SSH monitoring logic
├── frontend/
│   ├── templates/
│   │   └── index.html      # Main HTML template
│   └── static/
│       ├── styles.css      # CSS styling
│       └── script.js       # JavaScript functionality
├── requirements.txt        # Python dependencies
├── start.sh               # Startup script
├── .gitignore            # Git ignore file
└── README.md             # This file

🔧 API Endpoints

The application provides a REST API:

  • GET / - Main web interface
  • GET /api/servers - List all configured servers
  • POST /api/servers - Add a new server
  • DELETE /api/servers/<server_id> - Remove a server
  • GET /api/metrics/<server_id> - Get metrics for a specific server
  • GET /api/metrics/all - Get metrics for all servers
  • POST /api/test-connection - Test SSH connection

🔐 Security Considerations

  1. SSH Keys: Use SSH key authentication when possible instead of passwords
  2. Network Security: Run on a secure network or use VPN
  3. User Permissions: Use limited SSH users with minimal required permissions
  4. Firewall: Configure firewalls appropriately
  5. HTTPS: For production, serve over HTTPS using a reverse proxy

🐛 Troubleshooting

Common Issues

Connection Timeouts:

  • Verify SSH port is accessible
  • Check firewall settings
  • Ensure SSH service is running on target server

Permission Denied:

  • Verify username and password/key
  • Check SSH user permissions
  • Ensure SSH key has correct permissions (600)

Metrics Not Loading:

  • Check if target server has required commands (top, free, df)
  • Verify user has permission to execute system commands

Debug Mode

To run in debug mode for development:

export FLASK_DEBUG=1
cd backend
python app.py

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

📝 License

This project is open source and available under the MIT License.

🙏 Acknowledgments

  • Built with Flask web framework
  • SSH connectivity via Paramiko library
  • UI icons from Font Awesome
  • Responsive design principles

📞 Support

For issues and questions:

  1. Check the troubleshooting section
  2. Open an issue on GitHub
  3. Review the code for customization options

Happy Monitoring! 🚀📊

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published