ske087 87a51c7950 fix: Resolve JavaScript undefined error in database reset function
- 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
2025-08-14 16:13:24 +03:00

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:
git clone https://gitea.moto-adv.com/ske087/Server_Monitorizare.git
cd Server_Monitorizare
  1. Install dependencies:
pip3 install flask requests sqlite3
  1. Set up the database:
python3 Working_Files/initalizedb.py
  1. Configure port capabilities (for port 80):
sudo setcap 'cap_net_bind_service=+ep' $(which python3)
  1. 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 logs
  • POST /log - Alternative logging endpoint

Device Management

  • GET / - Main dashboard
  • GET /devices - Device management interface
  • GET /device_logs/<hostname> - Device-specific logs

Command Execution

  • POST /execute_command - Execute command on specific device
  • GET /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 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

Description
No description provided
Readme 258 KiB
Languages
HTML 71.5%
Python 28.5%