feat: portar panel Sistema del widget previo + servicio de captura
Pestaña Sistema: - Reproduce las 9 gráficas del widget anterior dibujadas con Cairo sobre históricos en memoria: CPU, RAM, CPU temp, GPU, GPU temp, VRAM, red (down/up superpuestos) y disk I/O, más las barras de uso de los discos /, /mnt/1tb, /mnt/2tb y /mnt/16tb. - metric.sh portado (nvidia-smi + coretemp hwmon) para temperaturas y métricas de GPU. - Paleta Nord, igual que el panel original. Widget redimensionado a 290x545 para acomodar el panel Sistema. Servicio de captura (service/): - packet-capture.service: dumpcap en ring buffer (~10 min, 10 archivos de hasta 60s/50MB, tope ~500MB) escribiendo en /var/log/pktcap. - install-capture.sh: crea el directorio, instala y activa el unit. El botón Wireshark abre ahora el .pcapng más reciente del buffer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# Instala el servicio systemd packet-capture (dumpcap ring buffer ~10 min).
|
||||
# Crea el directorio de captura propiedad del usuario, copia el unit, lo activa
|
||||
# y muestra su estado. Requiere privilegios sudo (los pedirá si no están en caché).
|
||||
#
|
||||
# Uso: install-capture.sh [interfaz] (por defecto enp5s0)
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
UNIT_SRC="$SCRIPT_DIR/packet-capture.service"
|
||||
UNIT_DST="/etc/systemd/system/packet-capture.service"
|
||||
CAP_DIR="/var/log/pktcap"
|
||||
USER_NAME="${SUDO_USER:-$USER}"
|
||||
IFACE="${1:-enp5s0}"
|
||||
|
||||
echo "==> packet-capture install (interfaz: $IFACE, usuario: $USER_NAME)"
|
||||
|
||||
if ! command -v dumpcap >/dev/null 2>&1; then
|
||||
echo "ERROR: dumpcap no instalado. Instalar: sudo apt install wireshark" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. Directorio de captura, propiedad del usuario que ejecuta dumpcap
|
||||
sudo mkdir -p "$CAP_DIR"
|
||||
sudo chown "$USER_NAME:$USER_NAME" "$CAP_DIR"
|
||||
sudo chmod 750 "$CAP_DIR"
|
||||
echo " dir: $CAP_DIR (owner $USER_NAME)"
|
||||
|
||||
# 2. Instalar el unit, ajustando interfaz y usuario
|
||||
sudo cp "$UNIT_SRC" "$UNIT_DST"
|
||||
sudo sed -i \
|
||||
-e "s|-i enp5s0|-i $IFACE|" \
|
||||
-e "s|^User=.*|User=$USER_NAME|" \
|
||||
-e "s|^Group=.*|Group=$USER_NAME|" \
|
||||
"$UNIT_DST"
|
||||
echo " unit: $UNIT_DST"
|
||||
|
||||
# 3. Activar y arrancar
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now packet-capture.service
|
||||
sleep 2
|
||||
|
||||
echo "==> Estado:"
|
||||
sudo systemctl --no-pager --full status packet-capture.service | head -12 || true
|
||||
echo "==> Capturas en $CAP_DIR:"
|
||||
ls -lh "$CAP_DIR" 2>/dev/null | tail -3 || true
|
||||
echo "==> Parar: sudo systemctl stop packet-capture.service"
|
||||
echo "==> Logs: journalctl -u packet-capture.service -f"
|
||||
@@ -0,0 +1,26 @@
|
||||
[Unit]
|
||||
Description=Packet capture ring buffer (~10 min, dumpcap) for conky_widget
|
||||
Documentation=https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/dataforge/conky_widget
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
# dumpcap escribe un ring buffer rotativo: 10 archivos de hasta 60s o 50MB cada
|
||||
# uno, lo que ocurra antes. Resultado: siempre los ultimos ~10 minutos de
|
||||
# trafico en disco (tope ~500MB para no llenar el disco con descargas grandes).
|
||||
#
|
||||
# Variantes utiles (editar la linea ExecStart):
|
||||
# - Solo cabeceras (mucho mas ligero): añadir -s 96
|
||||
# - Ver dominios (SNI/DNS) sin payload: añadir -s 320
|
||||
# - Filtrar una IP/puerto: añadir -f "host 1.2.3.4"
|
||||
Type=exec
|
||||
User=enmanuel
|
||||
Group=enmanuel
|
||||
SupplementaryGroups=wireshark
|
||||
ExecStart=/usr/bin/dumpcap -i enp5s0 -b duration:60 -b files:10 -b filesize:51200 -w /var/log/pktcap/cap.pcapng
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
Nice=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user