- Added event parameter to resetDatabase function - Fixed 'Cannot read properties of undefined' error - Added null checks for date range values - Improved button state management with fallback selectors - Enhanced error handling for edge cases
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
- Clone the repository:
git clone https://gitea.moto-adv.com/ske087/Server_Monitorizare.git
cd Server_Monitorizare
- Install dependencies:
pip3 install flask requests sqlite3
- Set up the database:
python3 Working_Files/initalizedb.py
- Configure port capabilities (for port 80):
sudo setcap 'cap_net_bind_service=+ep' $(which python3)
- Start the server:
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 logsPOST /log- Alternative logging endpoint
Device Management
GET /- Main dashboardGET /devices- Device management interfaceGET /device_logs/<hostname>- Device-specific logs
Command Execution
POST /execute_command- Execute command on specific deviceGET /device_status/<ip>- 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 logsPOST /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:
- Run the companion app on port 80
- Send logs to the server via POST requests
- Respond to remote commands and status requests
- Support auto-update functionality
Development
Adding New Features
- Create new routes in
server.py - Add corresponding HTML templates in
templates/ - Update database schema if needed
- 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
- Port 80 Permission Denied: Use
setcapcommand as shown in installation - Database Locked: Ensure no other processes are accessing the database
- Device Communication Errors: Check network connectivity and firewall settings
Logs Location
- Server logs: Check terminal output or use
/server_logsendpoint - Database logs: Stored in SQLite database, accessible via web interface
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- 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
Description
Languages
HTML
71.5%
Python
28.5%