How andersonvictor/telemetria works
Project Type and Purpose
• This is a full-stack web application for real-time telemetry and device monitoring.
• Backend in PHP with MySQL, frontend in HTML/CSS/JS using Bootstrap, Chart.js and DataTables.
• A Python script (pingEscala.py) performs periodic pings and logs or writes data to the database.
File Structure
• Top-level PHP scripts:
• login.php / logout.php – authentication endpoints
• index.php – main dashboard view
• datos.php – JSON API serving telemetry data
• export_excel.php & SimpleXLSXGen.php – Excel report generator
• verify_events.php, fix_existing_counters.php – administrative tools
• assets/ – static files
• js/script.js – custom frontend logic
• datatables config and images
• logs/ – output from ping_monitor (daily log files)
• pingEscala.py – external Python ping worker
• vendor/ & composer.* – third-party PHP dependencies
README for Insights
• Describes three tiers: presentation (HTML/CSS/JS), application logic (PHP scripts), data storage (MySQL).
• Mentions real-time monitoring, historical reports, Excel export, user roles.
Main Components and Their Interactions
a. User Browser (Clients)
• Interacts over HTTP/HTTPS with the web server.
b. Web Server & PHP Backend
• Serves static assets and dynamic pages (login, dashboard).
• datos.php exposes REST-style JSON for charts and tables.
• export_excel.php uses SimpleXLSXGen to stream .xlsx files.
• Authentication and session management for admin/regular users.
c. Database (MySQL)
• Stores device records, ping results, user credentials, historical data.
d. Ping Worker (pingEscala.py)
• Scheduled via cron or service.
• Performs ICMP pings to devices.
• Inserts results into MySQL and/or writes to logs/ping_monitor_YYYYMMDD.log.
e. Logging Subsystem
• PHP scripts log errors or audit events to logs/.
• Python script logs ping activity separately.
Architectural Patterns and Design Principles
• Three-Tier Architecture: Presentation / Application / Data layers.
• Separation of Concerns:
• Frontend (assets/, script.js, Chart.js, DataTables)
• Backend API (datos.php)
• Report Generator (export_excel.php + SimpleXLSXGen)
• Cron-based worker for asynchronous data collection.