From 24b8257a1f3ebb3a528b8782ad3da08b82f9ccb8 Mon Sep 17 00:00:00 2001 From: ske087 Date: Thu, 14 Aug 2025 15:57:33 +0300 Subject: [PATCH] docs: Add comprehensive README.md documentation - Complete installation and setup instructions - Feature overview and API documentation - Configuration guide and troubleshooting - File structure and development guidelines - Security features and device integration info --- README.md | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..282ce09 --- /dev/null +++ b/README.md @@ -0,0 +1,183 @@ +# Server Monitorizare - Device Management System + +A comprehensive Flask-based server monitoring and device management system for Raspberry Pi devices. + +## Features + +### 🖥️ Device Management Dashboard +- Real-time device monitoring and status tracking +- Centralized logging and event management +- Device information and configuration overview + +### 🚀 Remote Command Execution +- Execute system commands on remote devices via web interface +- Support for system updates, package installation, and maintenance tasks +- Secure command execution with proper error handling + +### 🔄 Auto-Update System +- Coordinate automatic updates across multiple devices +- Version checking and rollback capabilities +- Secure file transfer using SCP with authentication + +### 📊 Database Management +- SQLite database for comprehensive logging +- Database reset functionality with safety confirmations +- Data export and backup capabilities + +### 📋 Server Logs Interface +- Dedicated server operations monitoring +- Log filtering and categorization +- Real-time statistics and operation tracking + +### 🌐 Web Interface +- Modern responsive design with Bootstrap +- Intuitive navigation and user-friendly interface +- Multi-device support and mobile compatibility + +## System Requirements + +- Python 3.7+ +- Flask web framework +- SQLite3 database +- Linux environment (Raspberry Pi OS recommended) +- Network connectivity for device communication + +## Installation + +1. Clone the repository: +```bash +git clone https://gitea.moto-adv.com/ske087/Server_Monitorizare.git +cd Server_Monitorizare +``` + +2. Install dependencies: +```bash +pip3 install flask requests sqlite3 +``` + +3. Set up the database: +```bash +python3 Working_Files/initalizedb.py +``` + +4. Configure port capabilities (for port 80): +```bash +sudo setcap 'cap_net_bind_service=+ep' $(which python3) +``` + +5. Start the server: +```bash +python3 server.py +``` + +## Configuration + +### Device Communication +The server communicates with devices on **port 80**. Ensure your devices are configured to run on this port. + +### Database Setup +The system uses SQLite database located at `data/database.db`. The database is automatically created on first run. + +## API Endpoints + +### Device Logging +- `POST /logs` - Submit device logs +- `POST /log` - Alternative logging endpoint + +### Device Management +- `GET /` - Main dashboard +- `GET /devices` - Device management interface +- `GET /device_logs/` - Device-specific logs + +### Command Execution +- `POST /execute_command` - Execute command on specific device +- `GET /device_status/` - Get device status + +### Auto-Update +- `POST /auto_update_devices` - Trigger auto-update on all devices +- Database reset and management endpoints + +### Server Operations +- `GET /server_logs` - Server operations logs +- `POST /reset_database` - Reset database (with confirmation) + +## File Structure + +``` +Server_Monitorizare/ +├── server.py # Main Flask application +├── data/ +│ └── database.db # SQLite database +├── templates/ # HTML templates +│ ├── dashboard.html # Main dashboard +│ ├── device_management.html +│ ├── device_logs.html +│ ├── server_logs.html +│ └── ... +├── Working_Files/ # Utility scripts +│ ├── initalizedb.py # Database initialization +│ └── ... +└── README.md # This file +``` + +## Security Features + +- Secure command execution with timeout protection +- Database transaction safety +- Input validation and sanitization +- Error logging and monitoring + +## Device Integration + +This server works in conjunction with device applications running on Raspberry Pi devices. The devices should: + +1. Run the companion app on port 80 +2. Send logs to the server via POST requests +3. Respond to remote commands and status requests +4. Support auto-update functionality + +## Development + +### Adding New Features +1. Create new routes in `server.py` +2. Add corresponding HTML templates in `templates/` +3. Update database schema if needed +4. Test thoroughly before deployment + +### Database Schema +The system uses a simple logging table with fields: +- hostname, device_ip, nume_masa, timestamp, event_description + +## Troubleshooting + +### Common Issues +1. **Port 80 Permission Denied**: Use `setcap` command as shown in installation +2. **Database Locked**: Ensure no other processes are accessing the database +3. **Device Communication Errors**: Check network connectivity and firewall settings + +### Logs Location +- Server logs: Check terminal output or use `/server_logs` endpoint +- Database logs: Stored in SQLite database, accessible via web interface + +## Contributing + +1. Fork the repository +2. Create a feature branch +3. Make your changes +4. Test thoroughly +5. Submit a pull request + +## License + +This project is developed for internal use. Please respect the licensing terms. + +## Support + +For support and questions, please contact the development team. + +--- + +**Version**: 1.0.0 +**Last Updated**: August 14, 2025 +**Author**: SKE087 +**Repository**: https://gitea.moto-adv.com/ske087/Server_Monitorizare.git