|
|
@@ -0,0 +1,277 @@
|
|
|
+<h1 align="center">
|
|
|
+ <img alt="SQUIDSTAT logo" src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/squidstats.png" width="300px"/><br/>
|
|
|
+ <strong>El análisis definitivo para tu proxy</strong>
|
|
|
+</h1>
|
|
|
+
|
|
|
+<div align="center">
|
|
|
+ <!-- Banderas -->
|
|
|
+ <a href="https://github.com/kaelthasmanu/SquidStats/blob/master/README_es.md">
|
|
|
+ <img height="20px" src="https://img.shields.io/badge/ES-flag.svg?color=555555&style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3NTAgNTAwIj4NCjxwYXRoIGZpbGw9IiNjNjBiMWUiIGQ9Im0wLDBoNzUwdjUwMGgtNzUweiIvPg0KPHBhdGggZmlsbD0iI2ZmYzQwMCIgZD0ibTAsMTI1aDc1MHYyNTBoLTc1MHoiLz4NCjwvc3ZnPg0K">
|
|
|
+ </a>
|
|
|
+ <a href="https://github.com/kaelthasmanu/SquidStats/blob/master/README.md">
|
|
|
+ <img height="20px" src="https://img.shields.io/badge/EN-flag.svg?color=555555&style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNjAgMzAiIGhlaWdodD0iNjAwIj4NCjxkZWZzPg0KPGNsaXBQYXRoIGlkPSJ0Ij4NCjxwYXRoIGQ9Im0zMCwxNWgzMHYxNXp2MTVoLTMwemgtMzB2LTE1enYtMTVoMzB6Ii8+DQo8L2NsaXBQYXRoPg0KPC9kZWZzPg0KPHBhdGggZmlsbD0iIzAwMjQ3ZCIgZD0ibTAsMHYzMGg2MHYtMzB6Ii8+DQo8cGF0aCBzdHJva2U9IiNmZmYiIHN0cm9rZS13aWR0aD0iNiIgZD0ibTAsMGw2MCwzMG0wLTMwbC02MCwzMCIvPg0KPHBhdGggc3Ryb2tlPSIjY2YxNDJiIiBzdHJva2Utd2lkdGg9IjQiIGQ9Im0wLDBsNjAsMzBtMC0zMGwtNjAsMzAiIGNsaXAtcGF0aD0idXJsKCN0KSIvPg0KPHBhdGggc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEwIiBkPSJtMzAsMHYzMG0tMzAtMTVoNjAiLz4NCjxwYXRoIHN0cm9rZT0iI2NmMTQyYiIgc3Ryb2tlLXdpZHRoPSI2IiBkPSJtMzAsMHYzMG0tMzAtMTVoNjAiLz4NCjwvc3ZnPg0K">
|
|
|
+ </a>
|
|
|
+</div>
|
|
|
+<a name="readme-top"></a>
|
|
|
+
|
|
|
+<h1 align="center">
|
|
|
+
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/)
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/blob/master/LICENSE)
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/stargazers)
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/members)
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/)
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/)
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/watchers)
|
|
|
+</h1>
|
|
|
+<h4 align="center">:star: Dame una estrella — me motivará a seguir mejorándolo!</h4>
|
|
|
+<!-- TABLE OF CONTENTS -->
|
|
|
+<details>
|
|
|
+ <summary>Tabla de Contenido</summary>
|
|
|
+ <ol>
|
|
|
+ <li>
|
|
|
+ <a href="#sobre-el-proyecto">Sobre el proyecto</a>
|
|
|
+ <ul>
|
|
|
+ <li><a href="#metas">Metas</a></li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a href="#comencemos">Comencemos</a>
|
|
|
+ <ul>
|
|
|
+ <li><a href="#prerequisitos">Prerequisitos</a></li>
|
|
|
+ <li><a href="#instalación-con-script">Instalación con Script</a></li>
|
|
|
+ <li><a href="#instalación-manual">Instalación manual</a></li>
|
|
|
+ <li><a href="#información-de-prueba">Información de prueba</a></li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li><a href="#por-hacer">Por hacer</a></li>
|
|
|
+ <li><a href="#colaboradores">Colaboradores</a></li>
|
|
|
+ <li><a href="#licencia">Licencia</a></li>
|
|
|
+ <li><a href="#contacto">Contacto</a></li>
|
|
|
+ <li><a href="#tecnologias-usadas">Tecnologías usadas</a></li>
|
|
|
+ <li><a href="#agradecimientos">Agradecimientos</a></li>
|
|
|
+ </ol>
|
|
|
+</details>
|
|
|
+
|
|
|
+<!-- ABOUT THE PROJECT -->
|
|
|
+## Sobre el proyecto
|
|
|
+
|
|
|
+*Una herramienta moderna para analizar los registros de Squid, que ofrece un panel de control elegante e intuitivo para visualizar los datos de conexión en tiempo real. Este proyecto ayuda a los administradores de red a supervisar y gestionar eficazmente las conexiones proxy de Squid.*
|
|
|
+
|
|
|
+**Puede ver ejemplos [aquí](https://github.com/kaelthasmanu/SquidStats/tree/main/assets "Examples").**
|
|
|
+<div align="center">
|
|
|
+ <img src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/photo_2025-03-16_10-33-06.jpg"
|
|
|
+ alt="fig1"
|
|
|
+ width="65%"
|
|
|
+ style="min-width: 300px; max-width: 800px; border: 1px solid #ddd; border-radius: 6px;"/>
|
|
|
+</div>
|
|
|
+<div align="center">
|
|
|
+ <img src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/photo_2025-04-04_15-45-33.jpg"
|
|
|
+ alt="fig2"
|
|
|
+ width="65%"
|
|
|
+ style="min-width: 300px; max-width: 800px; border: 1px solid #ddd; border-radius: 6px;"/>
|
|
|
+</div>
|
|
|
+<div align="center">
|
|
|
+ <img src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/photo_2025-04-21_02-13-38.jpg"
|
|
|
+ alt="fig3"
|
|
|
+ width="65%"
|
|
|
+ style="min-width: 300px; max-width: 800px; border: 1px solid #ddd; border-radius: 6px;"/>
|
|
|
+</div>
|
|
|
+
|
|
|
+### Metas
|
|
|
+
|
|
|
+- **_Análisis de registros en tiempo real_**: Analiza las conexiones activas de Squid y muestra información detallada.
|
|
|
+- **_Monitoreo de usuarios_**: Identifica las conexiones por nombre de usuario, URI y tipo de registro.
|
|
|
+- **_Resumen de métricas_**:
|
|
|
+ - Total de datos leídos y escritos por cada conexión.
|
|
|
+ - Número de solicitudes por conexión.
|
|
|
+ - Uso del grupo de retardos.
|
|
|
+- **_Panel interactivo_**: Interfaz clara para una fácil interpretación de los datos.
|
|
|
+- **_Estadísticas de caché de Squid_**:
|
|
|
+ - Entradas almacenadas. - Capacidad usada y libre
|
|
|
+ - Tamaño máximo y actual de caché
|
|
|
+ - Uso de espacio en disco e inodos
|
|
|
+ - Antigüedad de los objetos en caché
|
|
|
+- **_Registros de usuarios_**:
|
|
|
+ - Monitoreo de la actividad del usuario 👥
|
|
|
+ - Visualizaciones atractivas 📊
|
|
|
+ - Filtrado y búsqueda avanzados 🔍
|
|
|
+ - Resultados paginados 📄
|
|
|
+- **_Gráficos principales_**:
|
|
|
+ - Actividad de los 20 usuarios principales
|
|
|
+ - Uso de datos de los 20 usuarios principales
|
|
|
+ - Total de usuarios
|
|
|
+ - Total de datos transmitidos
|
|
|
+ - Total de solicitudes
|
|
|
+- **_Y más_**
|
|
|
+
|
|
|
+<a href="#readme-top"><img align="right" border="0" src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/up_arrow.png" width="22" ></a>
|
|
|
+---
|
|
|
+<!-- GETTING STARTED -->
|
|
|
+## Comencemos
|
|
|
+[](https://github.com/kaelthasmanu/SquidStats/)
|
|
|
+
|
|
|
+**El proceso de instalación completo con más detalle se puede encontrar [aquí](https://www.sysadminsdecuba.com/2025/04/squidstat-analizador-de-logs-de-squid-diferente-y-100-cubano/).**
|
|
|
+
|
|
|
+### Prerequisitos
|
|
|
+- Python 3.10+
|
|
|
+- Servidor proxy Squid
|
|
|
+- `squidclient` instalado en su servidor
|
|
|
+```bash
|
|
|
+apt install git python3 python3-pip python3-venv libmariadb-dev curl
|
|
|
+```
|
|
|
+- ⚠️ !!Importante ⚠️ Para compatibilidad con los registros de usuarios, utilice este formato en /etc/squid/squid.conf:
|
|
|
+```bash
|
|
|
+ logformat detailed \
|
|
|
+ "%ts.%03tu %>a %ui %un [%tl] \"%rm %ru HTTP/%rv\" %>Hs %<st %rm %ru %>a %mt %<a %<rm %Ss/%Sh %<st
|
|
|
+
|
|
|
+ access_log /var/log/squid/access.log detailed
|
|
|
+```
|
|
|
+### Instalación con Script
|
|
|
+1. Obtener el script con curl o wget:
|
|
|
+ ```bash
|
|
|
+ wget https://github.com/kaelthasmanu/SquidStats/releases/download/0.2/install.sh
|
|
|
+ ```
|
|
|
+
|
|
|
+2. Dar permisos de ejecución:
|
|
|
+ ```bash
|
|
|
+ sudo chmod +x install.sh
|
|
|
+ ```
|
|
|
+
|
|
|
+3. Correr el script:
|
|
|
+ ```bash
|
|
|
+ sudo ./install.sh
|
|
|
+ ```
|
|
|
+<a href="#readme-top"><img align="right" border="0" src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/up_arrow.png" width="22" ></a>
|
|
|
+---
|
|
|
+### Instalación Manual
|
|
|
+1. Clonar el repositorio:
|
|
|
+ ```bash
|
|
|
+ mkdir -p /opt/squidstats
|
|
|
+ git clone https://github.com/kaelthasmanu/SquidStats.git /opt/squidstats
|
|
|
+ ```
|
|
|
+2. Creación de un ambiente virtual (venv):
|
|
|
+ ```bash
|
|
|
+ cd /opt/squidstats/
|
|
|
+ python3 -m venv "/opt/squidstats/venv"
|
|
|
+ source venv/bin/activate
|
|
|
+ pip install --upgrade pip
|
|
|
+ ```
|
|
|
+3. Instalación de los requerimientos de python con pip o pip3:
|
|
|
+ ```bash
|
|
|
+ pip install -r /opt/squidstats/requirements.txt
|
|
|
+ ```
|
|
|
+4. Crear un fichero .env en la raíz del proyecto y agregar lo siguiente:\
|
|
|
+ Nota: para usar MARIADB necesita tener corriendo su servidor de Bases de Datos.
|
|
|
+ ```bash
|
|
|
+ VERSION=2
|
|
|
+ SQUID_HOST = "127.0.0.1"
|
|
|
+ SQUID_PORT = 3128
|
|
|
+ FLASK_DEBUG = "True"
|
|
|
+ DATABASE_TYPE="SQLITE"
|
|
|
+ SQUID_LOG = "/var/log/squid/access.log"
|
|
|
+ DATABASE_STRING_CONNECTION = "/opt/squidstats/"
|
|
|
+ REFRESH_INTERVAL = 60
|
|
|
+ ```
|
|
|
+5. Corra la aplicacion con python o python3 🚀:
|
|
|
+ ```bash
|
|
|
+ python3 app.py
|
|
|
+ ```
|
|
|
+6. En el navegador de su preferencia, visite el siguiente enlace:
|
|
|
+ ```bash
|
|
|
+ http://ip/hostname:5000
|
|
|
+ ```
|
|
|
+### ⚠️ Alerta en la primera corrida ⚠️
|
|
|
+Advertencia: 🚨 La primera vez que se ejecuta puede causar un alto uso de la CPU.
|
|
|
+
|
|
|
+🕒 Correrlo al inciiar el sistema operativo
|
|
|
+Para garantizar que la aplicación se inicie automáticamente cuando se inicia el sistema, agregue el siguiente trabajo al cron:
|
|
|
+1. Abrir con un editor el fichero crontab
|
|
|
+```bash
|
|
|
+nano /etc/crontab
|
|
|
+```
|
|
|
+2. Añada la siguiente linea al fichero de crontab(cambia path_app por tu ruta):
|
|
|
+```bash
|
|
|
+@reboot root nohup python3 path_app/app.py &
|
|
|
+```
|
|
|
+3. Save
|
|
|
+
|
|
|
+O podemos usar servicios(daemon):
|
|
|
+
|
|
|
+1. Copia el fichero de servicio:
|
|
|
+ ```bash
|
|
|
+ cp ./utils/squidstats.service /etc/systemd/system/squidstats.service
|
|
|
+ ```
|
|
|
+2. Reinicia daemons:
|
|
|
+ ```bash
|
|
|
+ systemctl daemon-reload
|
|
|
+ ```
|
|
|
+3. Actiba el servicio:
|
|
|
+ ```bash
|
|
|
+ systemctl enable squidstats.service
|
|
|
+ ```
|
|
|
+3. Inicia el servicio:
|
|
|
+ ```bash
|
|
|
+ systemctl start squidstats.service
|
|
|
+ ```
|
|
|
+<a href="#readme-top"><img align="right" border="0" src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/up_arrow.png" width="22" ></a>
|
|
|
+---
|
|
|
+## Información de prueba
|
|
|
+Este software ha sido probado exhaustivamente y es compatible con la versión 6.12 de Squid. Asegúrese de que su instalación de Squid sea compatible con esta versión o una posterior para un rendimiento óptimo.
|
|
|
+
|
|
|
+## Por hacer
|
|
|
+*Make blah blah.*
|
|
|
+
|
|
|
+## Colaboradores
|
|
|
+1. Clona el repositorio:
|
|
|
+ ```bash
|
|
|
+ git checkout -b feature-name
|
|
|
+ ```
|
|
|
+2.Crea una nueva rama para tu función o corrección:
|
|
|
+ ```bash
|
|
|
+ git checkout -b feature-name
|
|
|
+ ```
|
|
|
+3.Confirme sus cambios y envíe la rama:
|
|
|
+ ```bash
|
|
|
+ git push origin feature-name
|
|
|
+ ```
|
|
|
+4.Abrir una solicitud de extracción.
|
|
|
+
|
|
|
+**Colaboradores**
|
|
|
+<table style="width:100%">
|
|
|
+ <tr>
|
|
|
+ <th><b>Kaelthas</b></th>
|
|
|
+ <th><b>Alexminator</b></th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td align="center"><a href="https://github.com/kaelthasmanu"><img src="https://avatars.githubusercontent.com/u/39976595?v=4" width=150px height=150px alt="kaelthasmanu"/></a></td>
|
|
|
+ <td align="center"><a href="https://github.com/alexminator"><img src="https://avatars.githubusercontent.com/u/9116486?s=400&v=4" width=150px height=150px alt="alexminator"/></a></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td align="center"></a> <a href="https://www.linkedin.com/in/manuel-gorrin-095242238/"><img src="assets/linkedin-48.png" width="32px" height="32px"></a><a href="https://t.me/king_0f_deathhh"><img src="assets/telegram-app-48.png" width="32px" height="32px"></a></td>
|
|
|
+ <td align="center"><a href="https://twitter.com/alexminator99"><img src="assets/x_48.png" width="32px" height="32px"></a> <a href="https://www.linkedin.com/in/alexander-rivas-73532037/"><img src="assets/linkedin-48.png" width="32px" height="32px"></a><a href="https://t.me/Alexminator"><img src="assets/telegram-app-48.png" width="32px" height="32px"></a></td>
|
|
|
+ </tr>
|
|
|
+</table>
|
|
|
+
|
|
|
+## Licencia
|
|
|
+
|
|
|
+*El proyecto SquidStats se publica bajo la licencia <a href="https://github.com/kaelthasmanu/SquidStats/blob/master/LICENSE.md">MIT</a>.*
|
|
|
+
|
|
|
+<!-- CONTACT -->
|
|
|
+## Contacto
|
|
|
+> **_Necesita ayuda?_**
|
|
|
+**_Contácteme 📨 [manuelalberto.gorrin@gmail.com](mailto:manuelalberto.gorrin@gmail.com?Subject=SquidStats_issues)_**
|
|
|
+
|
|
|
+Enlace al proyecto: ([SquidStats](https://github.com/kaelthasmanu/cucuota))
|
|
|
+
|
|
|
+## Tecnologías usadas
|
|
|
+
|
|
|
+ Backend: Python, Flask
|
|
|
+ Frontend: HTML, CSS
|
|
|
+
|
|
|
+## Agradecimientos
|
|
|
+* _A la comunidad cubana de administradores de redes._
|
|
|
+* _A todo aquel que me brindo su ayuda cuando tenía dudas._
|
|
|
+
|
|
|
+<a href="#readme-top"><img align="right" border="0" src="https://github.com/kaelthasmanu/SquidStats/blob/main/assets/up_arrow.png" width="22" ></a>
|
|
|
+---
|