sergio_educacionit

monitor de proceos y archivos

Aug 12th, 2026
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. UMBRAL=80
  4.  
  5. ps -eo pid,user,%cpu,comm --no-headers | while read pid usuario cpu proceso
  6. do
  7. cpu_entero=${cpu%.*}
  8.  
  9. if [ "$cpu_entero" -ge "$UMBRAL" ]; then
  10. echo "========================================="
  11. echo "[ALERTA] Proceso: $proceso"
  12. echo "PID: $pid"
  13. echo "Usuario: $usuario"
  14. echo "CPU: ${cpu}%"
  15. echo
  16. echo "Archivos abiertos:"
  17. lsof -p "$pid"
  18. echo
  19. fi
  20. done
  21.  
Advertisement
Add Comment
Please, Sign In to add comment