sergio_educacionit

monitor carga mariadb

Aug 12th, 2026
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. UMBRAL=60
  4. USUARIO="root"
  5.  
  6. echo "Buscando consultas que superen los $UMBRAL segundos..."
  7.  
  8. mysql -u "$USUARIO" -p -e "SHOW FULL PROCESSLIST;" | while read id usuario host bd comando tiempo estado info
  9. do
  10. if [[ "$tiempo" =~ ^[0-9]+$ ]] && [ "$tiempo" -ge "$UMBRAL" ]; then
  11. echo "========================================="
  12. echo "[ALERTA] Consulta de larga duración"
  13. echo "ID: $id"
  14. echo "Usuario: $usuario"
  15. echo "Base de datos: $bd"
  16. echo "Tiempo: $tiempo segundos"
  17. echo "Estado: $estado"
  18. echo "Consulta: $info"
  19. echo
  20. fi
  21. done
Advertisement
Add Comment
Please, Sign In to add comment